Wednesday, January 11, 2012

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

Hi,

I'm not aware of the singleton model. Are there any guides for it?

Thanks.

On Jan 12, 2:50 am, Kai Cui <cuikai1...@gmail.com> wrote:
> hi,
>    Have you try to create a singleton model for ArrayAdapter? All your ArrayAdapters in different activities can share the same model.
> Kai,
>
> On Jan 11, 2012, at 4:19 PM, galapogos wrote:
>
>
>
>
>
>
>
> > 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

--
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