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.