Sencha touch 2 and phonegap are used to develop Web apps

Source: Internet
Author: User


1. Download sencha-touch-2-pr3 and phonegap-1.3.0;

2. Create WWW under assets (Java ee ide) and then create a JS folder under WWW, as shown below:

3. Copy the sencha-touch-all.js and phonegap-1.3.0.js to the JS folder;

4. Create libs in the project directory and copy the phonegap-1.3.0.jar to/libs;

5, the phonegap-1.3.0/Android below the XML copy to/RES below;

6. Modify the followingCodeThe modified code is as follows:

 

Package Huang. namespace;/* import android. app. activity */; import android. OS. bundle; import COM. phonegap. *; public class firstappactivity extends droidgap {/** called when the activity is first created. * // @ override public void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); // setcontentview (R. layout. main); super. loadurl ("file: // android_asset/www/index.html ");}}

(1) inherit activity to inherit droidgap;
(2) Comment out setcontentview (R. layout. Main );

Add a row: Super. loadurl ("file: // android_asset/www/index.html ");
(3) Comment out import Android. App. Activity
(4)Add a row: Import com. phonegap .*;
7,Add XML code to androidmanifest. xml. For more information, see http://www.apkbus.com/android-19083-1-1.html;

8. Create a locatcam. js file under the JS folder. The result is as follows:

Locatcam. JS/*** @ author huanghuang */Ext. application ({// name: 'locatcam ', launch: function () {Ext. create ('ext. container ', {fullscreen: True, padding: 4, // width: '000000', items: [{xtype: 'call', UI: 'normal', text: 'photo', width: 80, Handler: function () {// alert ('Hello my name is huanghuang! '); // Wait for loading phonegap document. addeventlistener ("deviceready", ondeviceready, false); // function alertdismissed () {// processing} navigator. notification. alert ('You are the winner! ', // Display information alertdismissed, // warn the ignored callback function 'game over ', // Title 'done' // button name) ;}}]}) ;}});

 

# Create index.html under WWW

 
Index.html <! Doctype HTML public "-// W3C // dtd html 4.01 // en" "http://www.w3.org/TR/html4/strict.dtd"> <HTML>  

 

10. Copy resources under sencha touch 2 to www;

11. The final running result is displayed.

 

 

 

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.