When user back press on the login screen of my application application crashes. I use below code to launch my login activity -
private void showLoginActivity() {
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
I do some background operation in this screen through asynctask. I saw the logcat It's showing problem in asynctask as the login activity finishes and the task is still running. How can I resolve this problem ?
Thanks in advance