Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to create a custom cursoradapter that will use two different layouts depending on some data in the cursor. I keep reading about 'overriding getViewTypeCount() and getItemViewType()' to make this happen but I can't seem to figure out how to implement this.. Can someone explain how to do this??

This is my code for the bindView and newView methods:

Java
@Override
public void bindView(View view, Context context, Cursor cursor) {
    TextView tView = (TextView) view.findViewById(R.id.TextView1);
    tView.setText("The text");
}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    return mInflater.inflate(R.layout.item1, parent, false);
}
Posted
Updated 12-Dec-11 9:57am
v3

1 solution

I am no Android expert, but I'd start with this[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900