0
私はAndroidを勉強し始めました。私はJavaの知識は限られていますが、C/C++のobjective Cなどで半対応できます。私は持って来ましたが、私はpg73の "試してみてください:ステータスバーに通知を表示する"とは言いません。notificationIDは変数に解決することはできません
私はそれをすべて甘く書いてしまいましたが、アンドロイドのSDKとEclipse IDEに慣れていますが、このエラーは私のNotificationActivity.javaファイルにあります。
package com.androidtestingfun.www;
import android.app.Activity;
import android.os.Bundle;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
public class NotificationsActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.btn_displaynotif);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
displayNotification();
}
});
}
protected void displayNotification()
{
//---PendingIntent to launch activity if the user selects this notification---
Intent i = new Intent(this, NotificationView.class);
i.putExtra("notificationID", notificationID); //-----the second parameter here is getting an error
PendingIntent pendingIntent =
PendingIntent.getActivity(this, 0, i, 0);
NotificationManager nm = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
Notification notif = new Notification(
R.drawable.icon,
"Reminder: Meeting starts in 5 minutes",
System.currentTimeMillis());
CharSequence from = "System Alarm";
CharSequence message = "Meeting with customer at 3pm...";
notif.setLatestEventInfo(this, from, message, pendingIntent);
//---100ms delay, vibrate for 250ms, pause for 100ms and then vibrate for 500ms---
notif.vibrate = new long[] {100, 250, 100, 500};
nm.notify(notificationID, notif);//-----the first parameter here is getting an error
}
}
私を聞くことができる任意のアイデアは非常に私は私のビルドを掃除しようとしたが、それdidntのは助けるために何でもする、いただければ幸いです。
を...何ばか、明らかカントーを指摘して..私はそれが何か他のものだったと確信していた申し訳ありませんおかげで、それをソートしています。 –
btw助けてくれてありがとう。 –
問題なし、うれしい – MByD