Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SometimesIn Android applications, it is desirable to prevent scrolling on the main body of the app. This can be accomplished by adding the following to the window.onload function in your app.js file in PhoneGap.

...


window.onload = function() {
  addEvent(document, "touchmove", function(e) {
    e.preventDefault();
  });
  // the rest of your onload code can go here
};

very common for users to use the physical back button on the device itself, instead of a back button on the screen.

PhoneGap uses an event listener called "backbutton" to catch when a user presses the Android back button. The prepackaged PhoneGap Android project in Profound UI already handles this event and looks for the app to handle it in the Rich Display File simply by including a button with the id of "btnBack".  The button can be hidden on the screen if desired.

The button can have a JavaScript onclick action or a bound response property.  For example, if you bind the response property to a named RPG indicator that is also called btnBack, the RPG code to handle the back button would look as follows:

Code Block
If btnBack = *On;
  // handle back button response using RPG here
EndIf;

If a button with the id of "btnBack" is not defined on your screen, the application simply exits when the user presses the back button on the device.

Note that you can change the default "backbutton" event listener, if required, by modifying the app.js file in your project.