0
我正在開發一個web應用程序,我需要包含一個選項菜單,其中將包含應用程序的關於部分)。Eclipse PhoneGap上的Android OptionMenu
我所做的是以下幾點:
將Settings.xml(XML文件夾下找到)
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference android:key="music" android:title="@string/music_title" android:summary="@string/music_summary"
android:defaultValue="true" />
<CheckBoxPreference android:key="hints" android:title="@string/hints_title" android:summary="@string/hints_summary"
android:defaultValue="true" />
</PreferenceScreen>
Prefs.java類
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
}
在清單
<activity android:name="com.example.testphonegap.Prefs"
android:label="@string/action_settings">
</activity>
在我的MainActiv中ity.java:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.ldpi);
super.setStringProperty("loadingDialog", "Loading Silver Angel ...");
super.setIntegerProperty("loadUrlTimeoutValue", 50000);
super.loadUrl("file:///android_asset/www/index.html",50000);
}
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.about:
finish();
return true;
}
return false;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
現在的問題是,當我按關於菜單,應用程序關閉,並沒有發生錯誤。我有在日誌中的唯一的事情是:
12-10 11:53:19.944: D/CordovaActivity(1141): Paused the application!
12-10 11:53:19.944: D/CordovaWebView(1141): Handle the pause
12-10 11:53:20.604: W/IInputConnectionWrapper(1141): showStatusIcon on inactive InputConnection
12-10 11:53:22.054: D/CordovaActivity(1141): CordovaActivity.onDestroy()
12-10 11:53:22.054: D/CordovaWebView(1141): >>> loadUrlNow()
12-10 11:53:22.204: D/CordovaActivity(1141): onMessage(onPageStarted,about:blank)
12-10 11:53:22.685: D/Cordova(1141): onPageFinished(about:blank)
12-10 11:53:22.685: D/CordovaActivity(1141): onMessage(onPageFinished,about:blank)
12-10 11:53:22.685: D/CordovaActivity(1141): onMessage(exit,null)
你能告訴我,我做錯了什麼,請讓我能解決這個問題,小?
感謝
不同的問題作爲我的版本相同的問題不是2.6/2.5 ... –
您的索OVA版是在3.0以上 –