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のデータを取得して通知にCharsequenceとして表示することは可能ですか?

4

1 に答える 1

0

getText()はすでに CharSequence を返します。文字列に変換しないでください

于 2012-10-09T09:26:17.860 に答える