주 활동에서 알림을 만들려고합니다. 여기 생성자 Notification (int, String, long)이 정의되지 않았습니다.
내 코드입니다 -public class Notification extends Activity{
private static final int NOTIFY_ME_ID=1987;
private int count=0;
private NotificationManager mgr=null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mgr=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
notifyMe();
}
public void notifyMe(){
Notification notification = new Notification(R.drawable.icon,
"Notification text that will be shown on status bar.",
System.currentTimeMillis());
// The PendingIntent will launch activity if the user selects this
// notification
PendingIntent contentIntent = PendingIntent.getActivity(Notification.this,
0, new Intent(Notification.this, MainActivity.class), 0);
notification.setLatestEventInfo(Notification.this, "Content Title", "Content text",
contentIntent);
mgr.notify(NOTIFICATION_ID, notification);
}
그러나 나는 다음과 같은 오류 얻을 : 생성자 알림 (INT는, 문자열, 길이가) 정의되지
나는 오류 라인은 다음과 같습니다
에 그 활동의 이름을 변경하는 것이 좋습니다? 이 코드에서 내가 뭘하고 있는지 알고 싶습니다. –
예 이전 생성자도 API 9 이상에서만 작동해야합니다. 어떤 API를 컴파일하고 있습니까? –
API 레벨 8 - Froyo –