Tags down


closing application on hardware back button in android

By : mah
Date : October 16 2020, 03:08 PM
Does that help Create a function onActivityResult to your LoginActivity and call the MainActivity using the startActivityForResult()
code :
protected void onCreate(Bundle savedInstanceState) {
    startActivityForResult(new Intent(this, MainActivity.class), 1);

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) {
        if (data.getBooleanExtra("EXIT", false)) {
public void onBackPressed() {
    // super.onBackPressed();
    Intent intent = new Intent();
    intent.putExtra("EXIT", true);
    setResult(RESULT_OK, intent);

Share : facebook icon twitter icon

How to void application exit when press hardware back button android?

By : user11883
Date : March 29 2020, 07:55 AM
hope this fix your issue Don't mess with the back button behavior. In this case, you have to use a service to play and control your music. And stop the service when you want to stop the music.
You can send an Intent to the service and so, control the actions of your player. The activity is not a background class. Your Activity is the view of your application, so, if user want to leave the activity will be killed. So, to keep the sound playing (like a player) you have to user the service.

Exit application from android hardware back button in phonegap

By : user2866364
Date : March 29 2020, 07:55 AM
I wish this help you Is there a way to show a confirmation popup when you press the hardware back button in android devices to exit the phonegap/ionic application? , Try this:
code :
document.addEventListener('backbutton', function(event){
  event.preventDefault(); // EDIT
  navigator.app.exitApp(); // exit the app

React-Native: Go back on android hardware back button pressed

By : Deepak Kumar
Date : March 29 2020, 07:55 AM
it fixes the issue I am trying to add going back on webview when the android backbutton was pressed and I still couldn't manage to make it work.
code :
class MyComponent extends Component {
    state = {};
         BackHandler.addEventListener('hardwareBackPress', this.backHandler);
         BackHandler.removeEventListener('hardwareBackPress', this.backHandler);
    backHandler = () => {
        if(this.state.backButtonEnabled) {
            return true;

Android back stack one fragment, when pressing hardware back button shows the back stacked one.

By : laurablogist
Date : March 29 2020, 07:55 AM
I hope this helps you . You can handle onBackPressed method in this method, comment the line //super.onBackPressed();
code :
        public void onBackPressed() {
//            super.onBackPressed();
//Now check if current fragment is not home fragment
// then replace current fragment with home fragment
//if current fragment is home fragment then execute the following code
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
    homeIntent.addCategory( Intent.CATEGORY_HOME );


React native router flux - How to access back pressed from navigation bar (not hardware back button) in android?

By : Julio César
Date : March 29 2020, 07:55 AM
I hope this helps you . First of all, I'm very new to react native. I have used react native router flux for navigation in my project. , Register your scene as:
code :
componentDidMount() {
               'onRight': this.showNotifications,
               'onLeft': this.showSearch,
Related Posts Related Posts :
  • Can SchemaCrawler transfer data to another database?
  • decreasing in size when reversing and storing text from a file to another using Java
  • Spring Command Line App hangs after Async method calls complete
  • How to exit parent / ancestor frame on click of new frame
  • Creating a run time array that takes user input and creates array at run time & accepts 3 variables to calculate sum
  • I am expecting my boolean to be saved in shared preferences as true, however it always saves as false
  • Selenium - Testng : SoftAssert to be called inside each method or inside @afterTest
  • add java 9 system modules to compile in eclipse
  • Multiple JsonCreator annotated methods
  • How to get data from response body
  • Parsing nested elements with Spring Boot RestTemplate gives JSON parse error
  • Divide a list of digits using regex in Java
  • BufferedImage causes a program freeze on MacOs but not on Windows
  • Get all objects on ArrayList
  • Recursively counting special nodes in a tree
  • How to get the Message Id from a Spring Listener
  • Writing to files in HDFS from within spark transformation functions in Java
  • java swing change background to a selected cell (no columns or rows) at time
  • Where to store user profile images uploaded?
  • Unable to show Items in RecyclerView with Dynamic Data
  • I-net clear report's 17 Engine class setData is not keeping the data argument's sort order
  • What does "One hop per time interval " mean in the following statements?
  • How to change data from long to wide form in Java
  • JPA : field with @ManyToMany and @ManyToOne
  • Truncating java.util.Date to LocalDate *without* toInstant() because java.sql.Date gives UnsupportedOperationException
  • Adding in-app prices to my app
  • Find methods with modified code between two versions of a Java class
  • codingbat xyxThere always returning false
  • How to find common entries in a list, based off of one variable in the object?
  • In app subscription says "The item you requested is not available for purchase"
  • JDBC mysql Setting and retrieving data from a database
  • React on User Keyevents whitout laggs JavaFx
  • How to sign an xml with XADES4j, certificate store windows and Smart Card + PIN Code
  • Dynamically building conditions in JOOQ
  • Spring Boot can't find DataSource for JdbcTemplate
  • Do while loop will not read variable entered within loop
  • The method add(Figura2D) in the type Set<Figura2D> is not applicable for the arguments (Rettangolo)
  • Regex to match a string and exclude everything else until a new line
  • Mule ESB Two JSON arrays, merge one array into another with Dataweave
  • How to get an InputStream of a Java class properly? Gitlab CI fails
  • ListView items repeated
  • How do I determine the Big O of a recursive algorithm that includes an optimization?
  • How to programatically add variables to the Shell from which some code was invoked?
  • How to get variable names and their values contained in a single string?
  • java get all extended interfaces from base interface
  • How to send Jersey multipart but with a different content type for each file
  • Why is value set correctly even though we use different locks in different threads
  • Java 8 String Garbage collection
  • JPA Lock Mode behaviour
  • changing text on textview with button's onClickListener
  • JSNI methods do not get compiled or added to the resulting JavaScript apparently
  • How to compare rgb values, ignoring alpha
  • java jpanel synchronization with repaint() or: Is a Listener addable to swing's repaint?
  • How to make the `@Endpoint(id = "health")` working in Spring Boot 2.0?
  • Replacing pronouns throughout a String
  • java.io.IOException: Failed to read zip entry source
  • FTP upload does not work Android
  • Java multiple Classes and multiple main methods, execute all main methods
  • java.lang.IndexOutOfBoundsException: Index: 0, Size: 0?
  • How can I control the brightness of an Image?
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com