Wednesday, January 11, 2012

[android-developers] Using an adapter from another class/activity

Hi,

How can I use an ArrayAdapter from another activity? I tried doing the
following in MyListActivity.onCreate():
setListAdapter(SomeOtherActivity.myAdapter);
where myAdapter is defined and initialized in SomeOtherActivity.
However, I get an empty list, even though I verified that
SomeOtherActivity.myAdapter is fully populated via a call to
SomeOtherActivity.myAdapter.getCount();

If I define and initialize my own adapter in MyListActivity with
setListAdapter(myLocalAdapter), it works. Once I switch it to
setListAdapter(SomeOtherActivity.myAdapter), I get an empty list.

Help please? Thanks.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate