我想學習如何在android中使用菜單我剛剛在menu.xml文件中添加了幾個子項,並運行它。在控制檯中的一切似乎正常,但當我檢查logcat的許多錯誤顯示up.I不知道什麼是錯的我無法弄清楚我5天機器人編程expresience.Can請您help.Thank是提前困惑我怎樣才能讓mymenu運行
02-15 05:13:04.420: E/logwrapper(912): executing /system/bin/e2fsck failed: No such file or directory
02-15 05:13:04.440: E/logwrapper(915): executing /system/bin/e2fsck failed: No such file or directory
02-15 05:13:05.010: E/SurfaceFlinger(923): hwcomposer module not found
02-15 05:13:05.820: E/SurfaceFlinger(923): ro.sf.lcd_density must be defined as a build property
02-15 05:13:08.240: E/logwrapper(1175): executing /system/bin/ip failed: No such file or directory
02-15 05:13:08.240: E/logwrapper(1176): executing /system/bin/ip failed: No such file or directory
02-15 05:13:19.410: E/FlpHardwareProvider(1251): Error hw_get_module 'flp': -2
02-15 05:13:19.410: E/FlpHardwareProvider(1251): Error hw_get_module 'flp': -2
02-15 05:13:19.410: E/LocationManagerService(1251): no geocoder provider found
02-15 05:13:19.410: E/LocationManagerService(1251): No FusedProvider found.
02-15 05:13:19.410: E/LocationManagerService(1251): no geofence provider found
02-15 05:13:25.100: E/Netd(920): exec() res=0, status=256 for /system/bin/iptables -t mangle -A st_mangle_EXEMPT -d 10.0.2.4/32 -j MARK --set-mark 1
02-15 05:13:25.100: E/logwrapper(1561): executing /system/bin/ip failed: No such file or directory
02-15 05:13:25.100: E/logwrapper(1562): executing /system/bin/ip failed: No such file or directory
02-15 05:13:25.100: E/SecondaryTablController(920): ip route add failed: /system/bin/ip route add 10.0.2.2/32 via 0.0.0.0 dev eth0 table 60
02-15 05:13:25.100: E/ConnectivityService(1251): Exception trying to add a route: java.lang.IllegalStateException: command '16 interface fwmark exempt add 10.0.2.2/32' failed with '400 16 Failed to add exemption rule (File exists)'
02-15 05:13:37.460: E/StrictMode(1693): at com.android.mms.transaction.TransactionService.onNewIntent(TransactionService.java:224)
02-15 05:13:37.460: E/StrictMode(1693): at com.android.mms.transaction.TransactionService$ServiceHandler.handleMessage(TransactionService.java:621)
02-15 05:13:37.460: E/StrictMode(1693): at android.os.Looper.loop(Looper.java:137)
02-15 05:13:37.460: E/StrictMode(1693): at android.os.HandlerThread.run(HandlerThread.java:61)
: E/(): Device disconnected
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
這個我的代碼 休息
</menu>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">mymenu</string>
<string name="action_settings">Settings</string>
<string name="MenuItem">Open</string>
<string />
</resources>
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
它運行正常嗎? –
我這麼認爲。因爲在控制檯屏幕和模擬器正常啓動時,一切都看起來很正常,我也能夠看到Helloworld Textview但是沒有任何地方的菜單。我不知道哪一行很重要,需要過濾。因此,一小部分錯誤 – user2751773
您是否按菜單按鈕? –