android - 来自编辑文本字段的通知内容文本

标签 android notifications android-edittext charsequence

 EditText message = (EditText)findViewById(R.id.mess);
 Notification mNotification = new Notification.Builder(this)
  .setContentTitle("Remainder!")
  .setContentText(message)
  .setSmallIcon(R.drawable.ic_launcher)
  .setSound(soundUri)
  .build();     

它给我的错误是 ContentText 应该是 CharSequence。 我尝试了几个示例,但没有成功。

最佳答案

你必须改变这个:

String name = message.getText().toString();

然后设置:

.setContentText(name)

关于android - 来自编辑文本字段的通知内容文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20187941/

相关文章:

Android 前台服务 - 不显示三星 Galaxy 设备灯的通知

node.js - 关闭通知的选项

java - 如果在多个 EditText 中有输入,如何更改 TextView?

android - 实现 ListFragment 时隐藏 "Loading..."指示器

android - 无法在 Android studio 中打开 "Project Structure"

android - 在 Android 中,如何获取滚动 Pane

Python 显示带有可见超时的通知

android - 如何更改 edittext 文本选择 handle 的颜色?

java - Android 中 findViewById() 上的 NullPointerException

android - 无法解析 ':app@debug/compileClasspath' : Could not resolve com. google.android.gms :play-services-basement:[15. 0.0,16.0.0 的依赖关系)