好吧,我正在創建一個具有菜單的應用程序,並且有三個菜單項是關於一個是去一個網頁和一個退出應用程序。 出口和對工作正常,但網頁菜單項不起作用,它強制關閉,這裏是我的菜單代碼:MenuItem打開鏈接的意圖?
public boolean onCreateOptionsMenu(Menu menu){
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){
case R.id.about:
startActivity(new Intent("com.example.ABOUT"));
return true;
case R.id.facebook:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("www.facebook.com"));
startActivity(browserIntent);
return true;
}
return false;
}
有人能告訴我什麼是錯了嗎?
你可以發佈logcat跟蹤嗎? – Mxyk 2012-07-23 17:15:18
肯定給我一秒 – Moussa 2012-07-23 17:15:53