Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi .
im developing an android application & also im using AsyncTask Class .
as you know this class has some important methods
1-onPreExecute() 2-doInBackground(Params...)3-onPostExecute(Result)
4-onProgressUpdate(Progress...)
now i want to create a button dynamically in onProgressUpdate(Progress...) or doInBackground(Params...) . but it doesnt let me to create it . i think constructor is the problem . i dont know what context should i use as the Constructor .
Can i create a button in these methods ?!
Posted
Comments
Richard MacCutchan 16-Dec-14 9:15am    
I don't think you are allowed to do that in the Async task because it does not 'own' the screen display. You should pass information to the main task which can then create the button. See http://developer.android.com/reference/android/os/AsyncTask.html.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900