I try to work with AsyncTaskLoader
and I have one problem. I load in AsyncTaskLoader
data from the internet then start other activity(BusModelsActivity) in method onLoadFinished
@Override
public void onLoadFinished(Loader<List<BusModelParcelable>> loader, List<BusModelParcelable> data) {
hideDialog();
Log.d("onLoadFinished", TestTags.TAG1);
Intent intent = new Intent(BusSearchParamActivity.this,BusModelsActivity.class);
intent.putParcelableArrayListExtra(AppVariables.BUS_MODELS_LIST, (ArrayList) data);
startActivity(intent);
}
but when I click back in activity BusModelsActivity and return to BusSearchParamActivity method onLoadFinished
run again, and BusModelsActivity starts again. What to do with it? I call other activity when click at button:
public void pickUpButtonClick(View v) {
getSupportLoaderManager().initLoader(LOADER_MODELS,null,busModelsCallBack);
}
where busModelsCallBack is implementation of LoaderCallbacks interface. When I did debug it stoped only on onLoadFinished, not onCreateLoader or click button.