In my application, i use tabs and it has settings, home etc tabs. In settings page there is a textview with some text. In home page there is an async task which runs in background.
Now what i want is, when user is watching settings page, and if the async task from home.java class completes doInBackground method, i want to update the textview in settings page.
How can i get the reference of the textview of settings page in the onPostExecute method of async task in home.class? Please give some clues or ways to implement this..
thank you..
You shouldn’t try to access the TextView directly from the onPostExecute() method of your AsyncTask. Instead temporally store the value you want to set to the TextView somewhere centrally, and retrieve it from there when the settings page is accessed.
To store the value you can use different mechanism. If you don’t need to persist it, you can use a singleton class which can be accessed from very where within you application. To persist the value you should use the shared preferences, a file or a database.
Check this page for more informations.