I
I
Inter Carpenter2015-10-26 22:37:41
Android
Inter Carpenter, 2015-10-26 22:37:41

How to prevent a return?

How can I disable the return to the previous page when pressing the "Back" button on the phone?
I have a preloader in my application in front of the page, it returns to it and spins all the time

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mark Doe, 2015-10-26
@mourr

You can, for example, handle the backbutton event and call event.preventDefault in it

document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
        document.addEventListener("backbutton", function (e) {
            e.preventDefault();
        }, false );
}

R
razer89, 2015-10-27
@razer89

In an activity you can't go back from, override the onBackPressed() method with an empty one

@Override
    public void onBackPressed() {
        // do nothing
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question