Building Android Apps with HTML, CSS, and JavaScript by Jonathan Stark; Brian Jepson

Building Android Apps with HTML, CSS, and JavaScript by Jonathan Stark; Brian Jepson

Author:Jonathan Stark; Brian Jepson
Language: eng
Format: mobi
Tags: COMPUTERS / Programming / Open Source
ISBN: 9781449325930
Publisher: O'Reilly Media
Published: 2012-01-14T10:00:00+00:00


$(document).ready(function(){

$('#settings form').submit(saveSettings);

loadSettings();

});

Unfortunately, loading the settings only at startup leaves a loophole that occurs if the user navigates to the Settings panel, changes some values, and taps the Cancel button without submitting the form.

In this case, the newly changed values will still be sitting there the next time the user visits the Settings panel; not because the values were saved (they weren’t), but because they are still just sitting there. If the user closes and reopens the app, the displayed values will revert to the saved values because the loadSettings() function will refresh them at startup.

There are several ways to rectify this situation, but I think the most appropriate is to refresh the displayed values whenever the Settings panel begins to move, either into or out of view.

Thanks to jQTouch, this is a simple matter of binding the loadSettings() function to the pageAnimationStart event of the Settings panel. Replace the line you just added with the code shown in bold:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.