使用菜单触发:
switch (id){
case R.id.action0:
Log.i(TAG,”Action0″);
FragmentTransaction ftrn = getFragmentManager().beginTransaction();
AlertDialog ad = new AlertDialog().newInstense(“Alert信息:”,”恭喜您中奖了!”,1);
ad.show(ftrn,TAG);
break;
case R.id.action1:
Log.i(TAG,”Action1″);
FragmentTransaction ft = getFragmentManager().beginTransaction();
PromptDialog pd = new PromptDialog().newInstense(“请输入新的手机号码:”,”例如:13300018888″);
pd.show(ft,TAG);
break;
case R.id.action2:
Log.i(TAG, “Action2″);
Toast.makeText(MainActivity.this,”Toast信息框”,Toast.LENGTH_LONG).show();
break;
default:
Log.i(TAG,”Nothing”);
break;
}
近期评论