Create class MyAsyncTask
private class MyAsyncTask extends AsyncTask<String, Integer, Integer>{
//Init
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}
//start hide
@Override
protected Integer doInBackground(String... params) {
// TODO Auto-generated method stub
return null;
}
//Init
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}
//start hide
@Override
protected Integer doInBackground(String... params) {
// TODO Auto-generated method stub
return null;
}
//update result
@Override
protected void onProgressUpdate(Integer... values) {
// TODO Auto-generated method stub
super.onProgressUpdate(values);
}
@Override
protected void onProgressUpdate(Integer... values) {
// TODO Auto-generated method stub
super.onProgressUpdate(values);
}
//finish run
@Override
protected void onPostExecute(Integer result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
}
}
@Override
protected void onPostExecute(Integer result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
}
}
Note:
– onPreExecute : this function will run first when class is called.
– doInBackground: this method run background so it don't impact OBJECT Ui
– onPreExecute : this function will run first when class is called.
– doInBackground: this method run background so it don't impact OBJECT Ui
– onProgressUpdate: receive args from publishProgress in doInBackground. This method syn UI is running.
– onPostExecute: This method is called when method doInBackground done.
0 comments:
Post a Comment