1
私の標準的なAndroid通知の右下には、そのようなパターンではなく、時間(例:12:00)が表示されません:11/1/16。常に3つの数字が "/"で分割されます。誰もが問題を知っていますか?Androidの通知のタイムスタンプが間違っています
私の標準的なAndroid通知の右下には、そのようなパターンではなく、時間(例:12:00)が表示されません:11/1/16。常に3つの数字が "/"で分割されます。誰もが問題を知っていますか?Androidの通知のタイムスタンプが間違っています
私はあなたがあなたの通知を行うか、khowはありませんが、私はあなたが使うべきだと思う:のSystem.currentTimeMillis()
例:
package com.test;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
public class TestActivity extends Activity {
private NotificationManager notificationManager;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
showNotification("My notification",android.R.id.text1);
}
private void showNotification(CharSequence text, int idNotify) {
Notification notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
Intent intent = new Intent();
intent.setClassName("com.test","com.test.TestActivity");
PendingIntent contentIntent = PendingIntent.getActivity(TestActivity.this, 0,intent,0);
notification.setLatestEventInfo(this, "My Notification",text, contentIntent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(idNotify, notification);
}
}
ありがとう!私はcurrentTimeMillis()を1000倍しました。それが問題でした! – Bernd
あなたは答えを受け入れるべきです:) – Fildor
今、私はそれを受け入れました:-)私はここで新しいので、方法を知らなかった。 – Bernd