MenuItem item = menu.add(1, BITCH, 1, "猪队友");
item.setTitle("实在是坑");
item.setIcon(R.mipmap.fuck);
case BITCH:
Toast.makeText(MainActivity.this, item.getText().toString()+"bitch").show();
startActivity(new Intent(MainActivity.this, SecondActivity.class));
item.setTitle("实在是坑");
item.setIcon(R.mipmap.fuck);
case BITCH:
Toast.makeText(MainActivity.this, item.getText().toString()+"bitch").show();
startActivity(new Intent(MainActivity.this, SecondActivity.class));
2016-04-28
onCreateOptionsMenu(Menu menu){
getInflater().inflate(R.menu.menu_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item){
int id = item.getItemId();
switch(id){
case R.id.one:
break;
default:
break;
}
}
getInflater().inflate(R.menu.menu_main, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item){
int id = item.getItemId();
switch(id){
case R.id.one:
break;
default:
break;
}
}
2016-04-28
NotificationManager manager;
int notification_ID = 007;
manager =(NotificationManager)getSystemService(Context.NOTIFICATION_MANAGER);
manager.notify(notification_ID, notification);
int notification_ID = 007;
manager =(NotificationManager)getSystemService(Context.NOTIFICATION_MANAGER);
manager.notify(notification_ID, notification);
2016-04-28
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent);
builder.setContentIntent(pendingIntent);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent);
builder.setContentIntent(pendingIntent);
2016-04-28
private void sendNotification(){
Builder builder = new Notification.Builder(this);
builder.setSmallIcon(R.drawable.smallIcon);
builder.setTicker("hello");
builder.setWhen(System.currentTimeMillis());
builder.setContentTitle("通知栏通知");
builder.setContentText("我来自阿尔莫多瓦星球");
}
Builder builder = new Notification.Builder(this);
builder.setSmallIcon(R.drawable.smallIcon);
builder.setTicker("hello");
builder.setWhen(System.currentTimeMillis());
builder.setContentTitle("通知栏通知");
builder.setContentText("我来自阿尔莫多瓦星球");
}
2016-04-28
1.获取NotificationManager
2.显示通知栏notify
3.取消通知栏cancel
4.构造Notification并显示内容
5.通知栏可以设置声音提示,指示灯以及震动效果等
2.显示通知栏notify
3.取消通知栏cancel
4.构造Notification并显示内容
5.通知栏可以设置声音提示,指示灯以及震动效果等
2016-04-28
LayoutInflater inflater = LayoutInflater.from(this);
View view = inflater.inflate(R.layout.dialog_layout, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("");
builder.setIcon(R.drawable.icon);
builder.setView(view);
AlertDialog dialog = builder.create().show();
View view = inflater.inflate(R.layout.dialog_layout, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("");
builder.setIcon(R.drawable.icon);
builder.setView(view);
AlertDialog dialog = builder.create().show();
2016-04-28
private void showDialog(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("确认对话框");
builder.setIcon(R.drawable.ic_launcher);
builder.setMessage("确认对话框提示内容");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener(){
});
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("确认对话框");
builder.setIcon(R.drawable.ic_launcher);
builder.setMessage("确认对话框提示内容");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener(){
});
}