Page 1 of 1

Backbutton event binds globally to the app, not to the single screen

Posted: Wed Aug 21, 2013 12:38 am
by Zahhar Kirillov

Another problem with 'Backbutton' events that seems like a bug. Please advise.

I have a screen named X with 'Backbutton' event, that openes a popup screen. I can navigate through my app and press hardware Back button on my Andreoid device with normal behaviour on all other screens, until I visit screen X. On screen X when hardware Back button is pressed, event is fired correctly and I see a popup.

After that something crashes, and app starts showing popup every time hardware Back button is pressed on any other screen. Feels like Backbutton event is global now. Is it a problem of my own app architecture, or a wider problem?

Thank you!


Backbutton event binds globally to the app, not to the single screen

Posted: Wed Aug 21, 2013 12:47 am
by Alena Prykhodko

Hello!

We'll reproduce the issue and let you know as soon as possible.


Backbutton event binds globally to the app, not to the single screen

Posted: Wed Aug 21, 2013 12:55 am
by Alena Prykhodko

What Android version do you have?


Backbutton event binds globally to the app, not to the single screen

Posted: Wed Aug 21, 2013 12:59 am
by Zahhar Kirillov

I run Android 2.3.3 (Overcome Kratos build 3.1) on my Samsung Galaxy Tab 7" P1000 device. Tomorrow I ill have access to several modern Androids and can report if problem persists.


Backbutton event binds globally to the app, not to the single screen

Posted: Wed Aug 21, 2013 1:07 pm
by Kateryna Grynko

Zahhar,

We couldn't reproduce it on Nexus7 4.2.2.
Please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a, tell us its name and what exactly we should do to reproduce the issue.


Backbutton event binds globally to the app, not to the single screen

Posted: Wed Aug 21, 2013 5:05 pm
by Zahhar Kirillov

Thanks, Katya!

My app is shared with you, named MBACard.

Steps to reproduce:

  1. Run the app with Appery.io.Tester

  2. On the first screen tap "Show Card" button in the footer. Next screen with card image and timer will be opened.

  3. Press hardware "Back" button on your device and you will see a popup displayed, with slider and OK button on it.

  4. Tap "OK" button - popup disappears, and you will be transfered back to the main screen.

  5. Now click hardware "Back" again: you still have a popup displayed! You migh also navigate through the app and press "Back" from other screens, and you will face popup all the time.

    I appreciate your help on this issue!

    Zahhar


Backbutton event binds globally to the app, not to the single screen

Posted: Wed Aug 21, 2013 6:35 pm
by Maryna Brodina

Hello! This is how it suppose to work. Ones you define event on backbutton on device ready event on current screen the following code is added:
code$(document).unbind('backbutton').bind({
"backbutton": function() {
//here is your code
}/code
that means this event has been defined for entire document. If you don't need this event triggered on other screens, but just on one of them (let's say ScreenX) then on other screens except ScreenX (I mean not all of them, only screens where you might navigate from ScreenX) on device ready event add the following code:
code$(document).unbind('backbutton');/code


Backbutton event binds globally to the app, not to the single screen

Posted: Wed Aug 21, 2013 10:13 pm
by Zahhar Kirillov

Thank you, Marina!

Should I also do
code$(window).unbind('orientationchange');/code

if I bind it on my ScreenX to execute one JS function only when that particular ScreeX changes orientation? All other screens have default behaviour.


Backbutton event binds globally to the app, not to the single screen

Posted: Thu Aug 22, 2013 12:06 am
by Illya Stepanov

Hi Zahhar -- jQuery Mobile API documentation should help:
:: http://api.jquerymobile.com/orientati...