After searching for a long , i went through the following links and understood ,
http://developer.android.com/reference/android/os/AsyncTask.html#cancel(boolean)
AsyncTask never executes onPostExecute
But i want to do some API hits to the server and after getting all the data , i want to move to my mainactivity from the Splashscreen , below is my code . . . .
class Startsyntask extends AsyncTask<Void, Void, Void>
{
@Override
protected Void doInBackground(Void... arg0)
{
raw_data = new File(Environment.getExternalStorageDirectory() + "/.MyFoldernew");
if(raw_data.exists())
{
Log.e("directory exists", " already ");
new read_syntask().execute();
}
else
{
Log.e("directory created", " newly ");
raw_data.mkdirs();
new write_syntask().execute();
}
return null;
}
@Override
protected void onPostExecute(Void unused)
{
if( i == 6)
{
finish();
startActivity(new Intent("com.sample.app.Tabbar"));
}
}
}
and in the code read_synctask
and write_synctask
are another asyncronous tasks that has some specific operations to do with , in these Asyncronous tasks it is calling the onPostexecute after doinBackground .
Actually it moves to the Tabbar Activity and the API hits continues and i get data read from server in Tabbar activity . how could i implement that only after completing the asyncronous task in doinBackground , onProgress should be called .