How to get the listview join viewpager android: id = "@ id / android: list" of listView.
Problem Description:
According to the conventional method is to get LayoutInflater online where the XML object
ListViewThen findViewById (R.id.listView) to get ListView object, as follows:
View convertView0 = viewInflater.inflate (R.layout.todaynews_, null);
LinearLayout linearLayout0 = (LinearLayout) convertView0
. FindViewById (R.id.todayNewsLayout);
listView = (ListView) convertView0
. FindViewById (R.id.listView);
The problem is the code I used the setListAdapter (adapter), this method requires a ListView id be so defined: android: id = "@ id / android: list". Because there is no custom id value, so can not be used
listView = (ListView) convertView0.findViewById (R.id.listView)to get a listView object, but can not use getListView () (because the current load is viewpager of ativity, will use this null pointer), my question is to know how to get listView object, please inform the twelve great gods, grateful.
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Grandpa had list.setAdapter () on it, beginner android shortcoming.
Reply:
Reply:
setListAdapter (adapter) first saw
Reply:
activit extend ListActivit can use setListAdapter (adapter) filled listview ah
Reply:
Reply:
You use getListView, Activity to inherit ListActivity
If you use an ordinary Activity getListView not get listview, nor can setListAdapter
Reply:
you use getListView, Activity to inherit ListActivity
If you use an ordinary Activity getListView not get listview, nor can setListAdapter
No comments:
Post a Comment