In my application. I have a login
screen. If the login is successful, a tab activity
will launch, in that there are 4 tabs. When I press one of the buttons in the tab, a new activity will launch. there is an event in my login
class that will get fired in some cases. I want to go back to the tab activity when the event get fired. I have written a code using Intent. That code is working fine. But after reaching the tab activity I don't want to go back to the activity when back button is pressed. I want to remove this. I want to show login when Back is pressed. Is there any way to do this? This is the code I have used:
Intent tabi=new Intent(getApplicationContext(),Tab.class);
startActivity(tabi);
The code onkeydown
in tab activity is:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
super.onKeyDown(keyCode, event);
return true;
}
return false;
}
Intent tabi=new Intent(getApplicationContext(),Tab.class);
startActivity(tabi);
finish();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With