Make sure that you are overriding getViewTypeCount() and getItemViewType() in your adapter.
On Sat, Sep 1, 2012 at 6:00 AM, Live Happy <[email protected]> wrote: > i create a cursoradapter that will use two different layouts depending on > "direction" field in the cursor. > this is the code > @Override > public View newView(Context context, Cursor cursor, ViewGroup parent) { > holder = new ViewHolder(); > if(cursor.getInt(cursor.getColumnIndex("direction"))==0) { > v = mInflater.inflate(R.layout.layout1, parent, false); > } else { > v= mInflater.inflate(R.layout.layout2, parent, false); > } > > holder.text = (TextView) v.findViewById(R.id.text); > . > . > . > . > . > v.setTag(holder); > return v; > } > @Override > public void bindView(View view, Context context, Cursor cursor) { > String text=cursor.getString(cursor.getColumnIndex("text") > . > . > . > Data data=new Data(text..........) > holder = (ViewHolder) view.getTag(); > if(cursor.getInt(cursor.getColumnIndex("direction"))==0) { > view=managelayout1(data,holder) > else > view=managelayout2(data,holder); > } > > the problem it is that after scrolling the layouts change postions data1 > appear in layout2 and data2 appear in layout1 randomly > if the facing items content the 2 differents layout if have one layout so > all the other data will appear in the same layout > it is there any way to save the postion of layout > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.1 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

