i have splash screen activity and after 3 sec second activity is starting.this is a first activity code
Handler handler=new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent in = new Intent(getApplicationContext(),
MainActivity.class);
startActivity(in);
overridePendingTransition(R.anim.trans_left_in,
R.anim.trans_left_out);
}
}, 3000);
and in MainActivity activity i wrote this method
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR
&& keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0) {
onBackPressed();
}
return super.onKeyDown(keyCode, event);
}
i have a problem.when i am second activity and click back button ,then i can't start second activity after 3 sec.how i can write code to can start again second activity?
Move start intent code in onResume :