kostbash kostbash - 3 years ago 112
Android Question

How to access resources from background thread

I try to access my string resource from the background thread. How can I do this?

I have the main UI thread where context available of course. And I am tring to implement AsyncTask descendent. In corresponding doInBackground method I have not access to my UI context respectivly. Resources is needed for URL building . I put some path parts into string resource.

Answer Source

It would be better to put your URL building blocks in String constants in Java so that you avoid the overhead of loading a resource.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download