Tuesday, August 9, 2011

[android-developers] Re: how best to access string resources from AsyncTask.doInBackground

On Aug 8, 10:57 pm, TreKing <treking...@gmail.com> wrote:
> Get them first, in the UI thread, then pass the actual String to the
> AsyncTask ... ?
>
> --------------------------------------------------------------------------- ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices


Thanks, that's what I've decided to do, at least for now. I pass the
Activity to the AsyncTask's constructor, pull out the strings I want
and stick them into member variables for later use by
doInBackground().

I also noticed while looking at the Activity class a little closer
that it's actually a ContextWrapper that contains a Context, so I'm
wondering if the inner Context survives the Activity destruction/
recreation. I'll have to debug a little to see if that's the case.

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

No comments:

Post a Comment