所以我正在编写一段代码,它可以让我在顶部的状态栏中运行一个应用程序,我是进入它的好方法,几乎完成了。我只需要对为什么我的“PendingIntent.getActivity(this,that,next,thing);”有第二意见 它没有编译。这是代码
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 NotifyMe extends Activity {
NotificationManager nm;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Intent MainActivity = new Intent(this, MainActivity.class);
PendingIntent pi = new PendingIntent.getActivity(this, 0, intent, 0);
String body = "Simple message";
String title = "Hello World";
Notification n = new Notification(R.drawable.note, body, System.currentTimeMillis());
n.setLatestEventInfo(this, title, body, pi);
}
}
所以我可能做错了,在这件事上的任何提示将不胜感激。