I have two Activities. Activity A gets a large amount of information from the web that activity B will use. Activity A uses a ProgressDialog to download the information and then fires the intent to start Activity B. This works fine, but after the ProgressDialog disappears there is about a 1-3 second pause before Activity B begins. Activity B uses the downloaded information to display a large ListView.
Is there anyway to prevent this pause after my ProgressDialog is done displaying?
Code for triggered event on Activity A
progressdialog = ProgressDialog.show(this, "", "Loading...");
mAsyncFacebookRunner.request("fql", paramaters, new FQLRequestListener());
Code for the Facebook RequestListener
private class FQLRequestListener implements RequestListener {
@Override
public void onComplete(String response, Object state) {
try {
// Load Lots of Data Here ...
Intent Invite = new Intent(ActivityA.this, ActivityB.class);
Bundle bundle = new Bundle();
bundle.putSerializable("items", items);
Invite.putExtras(bundle);
progressdialog.dismiss();
startActivityForResult(Invite, INVITE_FRIENDS);
} catch (JSONException e) {
} catch (FacebookError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void onIOException(IOException e, Object state) {
// TODO Auto-generated method stub
Log.d("exception", "IOException");
}
@Override
public void onFileNotFoundException(FileNotFoundException e,
Object state) {
// TODO Auto-generated method stub
Log.d("exception", "FNFException");
}
@Override
public void onMalformedURLException(MalformedURLException e,
Object state) {
// TODO Auto-generated method stub
Log.d("exception", "MalformedURLException");
}
@Override
public void onFacebookError(FacebookError e, Object state) {
// TODO Auto-generated method stub
Log.d("exception", "FacebookError");
}
}
That pause timing is nothing but the screen loading time of activity B. And loading the UI with data..
Don’t make the onCreate() method to large .. Do the Loading data to UI in some different Thread.. like AsynTask or in any normal thread.. Then It will be fine..