Dear Shane I just look thought your implement, it look quit OK, but i have a little convert about your constructor of ListAdaptor . Please let me see implement of ListAdaptor relate with implement when set view for each item in List >JobListAdaptor o = items.get(position);
Could you please check items have been initialized in constructor of ListAdaptor ? Regards, DatNQ On Tue, Feb 22, 2011 at 4:24 PM, Shane O'Reilly <[email protected]>wrote: > Hey everyone, I'm a little stuck right now. i'm getting some funky > errors when I try run my project. > > Basically what it's doing is pulling a number of entries from a DB and > displaying them in a custom ListAdaptor. > > I'm getting "ArrayAdapter requires the resource ID to be a TextView" > as a error > > Here's where the Listview is populated > > ______________________________ > public View getView(int position, View convertView, ViewGroup parent) > { > > View v = convertView; > if (v == null) { > LayoutInflater vi = > (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); > v = vi.inflate(R.layout.status_container_list_entry, > null); > } > JobListAdaptor o = items.get(position); > if (o != null) { > TextView tt = (TextView) v.findViewById(R.id.toptext); > TextView mt = (TextView) > v.findViewById(R.id.middletext); > TextView bt = (TextView) > v.findViewById(R.id.bottomtext); > //TextView st = (TextView) > v.findViewById(R.id.sidetext); > > if (tt != null) { > tt.setText("Name: "+ > o.getName()); > } > if(mt != null){ > mt.setText("Provider: "+ o.getProvider()); > } > if(bt != null){ > bt.setText("Most Recent Feed Date: "+ > o.getMostRecentFeedDate()); > } > //if(st != null){ > // st.setText("Status: "+ o.getStatus()); > //} > > } > return v; > ______________________________ > > > Here's the XML display > > ______________________________ > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:layout_width="fill_parent" > android:layout_height="?android:attr/listPreferredItemHeight" > android:padding="6dip"> > <ImageView > android:id="@+id/icon" > android:layout_width="wrap_content" > android:layout_height="fill_parent" > android:layout_marginRight="6dip" > android:src="@drawable/icon" /> > <LinearLayout > android:orientation="vertical" > android:layout_width="0dip" > android:layout_weight="1" > android:layout_height="fill_parent"> > <TextView > android:id="@+id/toptext" > android:layout_width="fill_parent" > android:layout_height="0dip" > android:layout_weight="1" > android:gravity="center_vertical" > /> > <TextView > android:layout_width="fill_parent" > android:layout_height="0dip" > android:layout_weight="1" > android:id="@+id/middletext" > android:singleLine="true" > android:ellipsize="marquee" > /> > <TextView > android:layout_width="fill_parent" > android:layout_height="0dip" > android:layout_weight="1" > android:id="@+id/bottomtext" > android:singleLine="true" > android:ellipsize="marquee" > /> > <TextView > android:layout_width="fill_parent" > android:layout_height="0dip" > android:layout_weight="1" > android:id="@+id/sidetext" > android:singleLine="true" > android:ellipsize="marquee" > /> > </LinearLayout> > </LinearLayout> > ______________________________ > > > > And where's its called in my Home Activity > > ______________________________ > private void showStatusItems(List<StatusContainer> list) > { > _loginLayout.setVisibility(View.INVISIBLE); > _mainLayout.setVisibility(View.VISIBLE); > > > ArrayAdapter<JobListAdaptor> listAdapter = new > ArrayAdapter<JobListAdaptor>(this, > R.layout.status_container_list_entry, > StatusContainer.getStatusItemList()); > > _statusContainerListView.clearChoices(); > _statusContainerListView.setAdapter(listAdapter); > > } > ______________________________ > > > Any help or tips would be greatly appreciated.. > > > -- > 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 -- 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

