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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to