Tuesday, August 9, 2011

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

On Aug 9, 2:46 am, rich friedel <rich.frie...@gmail.com> wrote:
> I don't know the performance hit but you can access your resource like this:
>
> String s = TheParentActivity.this.getString( R.string.your_string_resource
> );

Well, I don't want to access the parent activity from doInBackground,
since it might not be there due to device rotation or other
configuration changes. In fact, as I understand it, for this reason
it's not a good idea to make the AsyncTask a nonstatic nested class.

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