1

这是我的代码:

MyNM = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    int icon = R.drawable.ic_launcher;
    String tickerText = "Hello";
    Notification notification = new Notification(icon, tickerText, System.currentTimeMillis());

    String contentTitle = GetString(R.id.title);

    MyI = new Intent(getApplicationContext(), LyceumWebNotification.class);

    MyPI = PendingIntent.getActivity(getApplicationContext(), 0, MyI, 0);
    notification.setLatestEventInfo(getApplicationContext(), "Hello" , "Title: " + contentTitle, MyPI); 
    MyNM.notify(NOTIFICATION_ID, notification);


public String GetString(int id){
return ((TextView)this.findViewById(id)).getText().toString();

}

是否可以获取 TextView 的数据并显示为通知的字符序列?

4

1 回答 1

0

getText()已经返回一个 CharSequence。不要将其转换为字符串

于 2012-10-09T09:26:17.860 回答