===========前言==============
Notification 是 AndRoid 系统中特色功能,通过提示图标, 下拉状态栏 向用户发送提示消息
=================================
public class MainActivity extends Activity implements OnClickListener {
private Button sendButton = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sendButton = (Button)this.findViewById(R.id.sendButton);
sendButton.setOnClickListener(this);
}
public void onClick(View v){
switch(v.getId()){
case R.id.sendButton:
NotificationManager manager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notify = new Notification(R.drawable.ic_notify, "This is no", System.currentTimeMillis()); //提示的信息
notify.setLatestEventInfo(this, "222", "text", null); //提示窗体
manager.notify(1, notify);
break;
}
}
}