Aayush wrote:
> Hi,
>
> I want to show many listviews in one activity. Something like
>
> Textview
> Listview
> TextView
> Listview
> ..........
>
> Every listview has different type of adapter. For this, I made the
> activity class like:-
>
> public class ListTestActivity extends ListActivity {
>
> public void onCreate(Bundle savedInstanceState){
> super.onCreate(savedInstanceState);
> setContentView(R.layout.screen); // screen.xml file
> setListAdapter(new CustomAdapter(this);
> ...............................
> }
>
>
> class CustomAdapter extends ArrayAdapter {
> Activity context;
>
> public View getView(int position, View convertView, ViewGroup parent)
> {
> ...............................
> }
>
> In screen.xml file if I define Listview like:-
>
> <ListView
> android:id="@android:id/list"
>
> I can get one listview with the custom adapter in this kind of
> arrangement.
> But when I replace it by android:id="@+id/list2" and use it as
> R.id.list2, it throws nullpointer exception.
>
> Any pointers for this problem??
ListView thisIsYourSecondList=(ListView)findViewById(R.id.list2);
thisIsYourSecondList.setAdapter(ohSomeAdapterGoesHere);
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Looking for Android opportunities? http://wiki.andmob.org/hado
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---