You still have a bug in your code. The convertView variable may contain a recycled view, as described in the documentation. You are inflating a view every time, even when convertView is non-null.
Please review the documentation for the ArrayAdapter and only inflate a new view when convertView == null On Dec 1, 10:11 pm, umakantpatil <[email protected]> wrote: > Found the bug. > > In my code. android.R was included. I removed it and then problem got > solved. > thanks > > On Dec 2, 11:06 am, umakantpatil <[email protected]> wrote: > > > > > > > > > I'm extending ArrayAdapter. But it gives me Null pointer exception. > > > Get view is written as follows > > > @Override > > public View getView(int position, View convertView, ViewGroup > > parent) > > { > > View view; > > TextView title; > > TextView desc; > > //final ImageView image; > > > view = inflater.inflate(resId, parent, false); > > > try{ > > title = (TextView)view.findViewById(R.id.text1); > > desc = (TextView)view.findViewById(R.id.text2); > > //image = (ImageView)view.findViewById(R.id.icon); > > }catch(ClassCastException e){ > > throw e; > > } > > Map<String,?> item = listitem.get(position); > > title.setText(item.get("title").toString()); > > > It gives me error at line here. I'm setting the text on title. It says > > Null pointer exception. I know its because findViewById cant find > > title. > > In my XML i have clearly written text1 as id. > > <TextView > > android:id="@+id/text1" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:textAppearance="@style/articles_row_title" > > /> > > > Then findViewById cant find it ? -- 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

