I am using AsyncTask to upload data to UI. i wrote the code to download data from server in a separate method and i am calling that method from doinBackground. It will give error because UI methods can’t access from doInBackground.but, i want to access . any alternative process is there to access the UI method from doinBackground.?
Share
Call
publishProgress()indoInBackground(). Put your UI-updating logic inonProgressUpdate()of yourAsyncTask.onProgressUpdate()will be called on the main application thread (a.k.a., UI thread) after you callpublishProgress(). Here is a sample project demonstrating this.