Yes. Only override it in that one Activity
with
@Override
public void onBackPressed()
{
// code here to show dialog
super.onBackPressed(); // optional depending on your needs
}
don’t put this code in any other Activity
More Related Contents:
- How to use putExtra() and getExtra() for string data
- Send Email Intent
- How do I get the currently displayed fragment?
- Android intent filter for a particular file extension?
- Sending message through WhatsApp
- Check INTENT internet connection
- How to bring an activity to foreground (top of stack)?
- How to pass ArrayList of Objects from one to another activity using Intent in android?
- Override home and back button is case a boolean is true
- Determine addAction click for Android notifications
- Android: Share plain text using intent (to all messaging apps)
- What is a Sticky Broadcast?
- “Failure Delivering Result ” – onActivityForResult
- Customize Android Intent.ACTION_SEND
- Android Share Intent for a Bitmap – is it possible not to save it prior sharing?
- Send email via gmail
- Replacing default Phone app on Android 6 and 7 with InCallService
- Android app enable NFC only for one Activity
- Start a fragment via Intent within a Fragment
- Trying to UNINSTALL_SHORTCUT but shortcut won’t go away
- overridePendingTransition does not work when FLAG_ACTIVITY_REORDER_TO_FRONT is used
- what is the difference between sendStickyBroadcast and sendBroadcast in Android
- What is the meaning of android.intent.action.MAIN?
- Why does FLAG_ACTIVITY_CLEAR_TOP not work?
- Upload an Image from camera or gallery in WebView
- Passing a List from one Activity to another
- How do I properly fire ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS intent?
- How to take pictures from the camera without preview when my app starts?
- how to install CA certificate programmatically on Android without user interaction
- Android: startActivityForResult & setResult for a view class and an activity class