0
토스트 대신 메뉴에서 다른 활동을 호출하고 모든 활동에서 메뉴를 표시 할 수있는 방법을 안내해주세요. 게다가 나는 벽지와 같은 배경이나 내 모든 활동을위한 다른 것을 원합니다. 여기 메뉴에서 전화 활동
감사
코드package com.droidnova.android.howto.optionmenu;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
public class SimpleOptionMenu extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.settings: Toast.makeText(this, "You pressed the icon!", Toast.LENGTH_LONG).show();
break;
case R.id.services: Toast.makeText(this, "You pressed the text!", Toast.LENGTH_LONG).show();
break;
case R.id.icontext: Toast.makeText(this, "You pressed the icon and text!", Toast.LENGTH_LONG).show();
break;
}
return true;
}
}