On Android, PhoneGap packages local and online websites

Source: Internet
Author: User

Thank you @ gangzi for providing such a community communication platform, and I am especially grateful to gangzi for providing the upload permission. Haha, I am also sending a simple Demo today to contribute a little bit to the community.

Recently, I have been paying attention to mobile web development. I am more interested in the effects of web development programs. There may be a lot of people who need to know before using it. Here is a simple Demo, including the packaging of PhoneGap on Android, the camera example of PhoneGap, And the sencha version of The html5mobi community stored locally. Two other online versions are put in the directory. After the program is installed, you can directly open it and run it to see the effect. To run the open-source sencha example of html5mobi community locally, You need to download the source code and put it in the Android assets/www/directory. Because the example is large, it is not stored in the source code. Open source example blind address: http://www.html5mobi.com/uploads/FileUpload/97/a8e7b0f5b0ef562ec72696bf397428.zip

Apart from the Camera example, the core code is several lines, but you can see the results of each example. Feel the magic of mobile Web development.
The examples are all in the attachment. Please download them.
TestDemo.zip // source code
TestDemoApk.zip // The android installer apkAndroid code, mainly used for loadUrl.

Package com. android. testdemo; import android. app. alertDialog; import android. content. dialogInterface; import android. OS. bundle; import android. view. keyEvent; import com. phonegap. droidGap; /*** <a href = "/profile/author" target = "_ blank"> @ author </a> rongfzh 2011-12-23 */public class PhoneGapActivity4 extends DroidGap {/*( non-Javadoc) * <a href = "/profile/see" target = "_ blank"> @ see </a> com. phonegap. droidGap # onCreate (android. OS. bundle) */<a href = "/profile/Override" target = "_ blank"> @ Override </a> public void onCreate (Bundle arg0) {super. onCreate (arg0); // official sencha Demo super. loadUrl ("http://dev.sencha.com/deploy/touch/examples/kitchensink/"); // local html5mobi community // super. loadUrl ("file: // android_asset/www/index.html"); // super. loadUrl ("file: // android_asset/www/camera.html"); // super. loadUrl ("http://html5mobi.com/st2/index.html"); // super. loadUrl ("http://html5mobi.com/m/index.html");} <a href = "/profile/Override" target = "_ blank"> @ Override </a> public boolean onKeyDown (int keyCode, keyEvent) {if (keyCode = KeyEvent. KEYCODE_BACK) {new AlertDialog. builder (this )//. setIcon (R. drawable. files_test ). setTitle ("Exit prompt "). setMessage ("whether to exit this page "). setNegativeButton ("cancel", new DialogInterface. onClickListener () {public void onClick (DialogInterface dialog, int which ){}}). setPositiveButton ("OK", new DialogInterface. onClickListener () {public void onClick (DialogInterface Diener, int whichButton) {finish ();}}). show (); return true;} else {return super. onKeyDown (keyCode, event );}}}

 

The following is the program's:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.