2017-06-17 33 views

回答

0

當按下按鈕獲取從EDITTEXT

文本在按鈕

的OnClick方法生成由下面的代碼的通知:

// build notification 
String content = edtEditText.getText().toString(); 
Notification n = new Notification.Builder(this) 
      .setContentTitle("Title That you want") 
      .setContentText(content).build(); 


NotificationManager notificationManager = 
(NotificationManager) getSystemService(NOTIFICATION_SERVICE); 

notificationManager.notify(0, n); 

參考此鏈接用於產生通知 http://www.vogella.com/tutorials/AndroidNotifications/article.html

相關問題