我使用的是一个android扫描抢,用其架包开发其扫描功能
1、在android主activity的onCreate()中添加一个JS方法接口,用户UI端调用android主activity的方法
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Set by <content src="index.html" /> in config.xml
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl(Config.getStartUrl(), 10000);
//super.loadUrl("file:///android_asset/www/index.html")
appView.addJavascriptInterface(this, "MainActivity"); //js调用activity里方法的接口
}
如果主activity中有个open()方法,则在UI(sencha touch)端可以用 window.MainActivity.open();调用触发该方法