Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble with Intent for AlarmManager
    primarykey
    data
    text
    <p>Hey, so I have been making an application which sends weekly notifications at user-specified times.</p> <p>I have followed plenty of tutorials and seem to have read the same thing over and over, I just cant seem to get it to work. My application crashes when I call the new intent. Am I doing something wrong? is this the correct method of accomplishing this task? </p> <pre><code>public class AlarmService extends Activity { /// unimportant working code not added Intent mintent = new Intent(context, mBroadcastReceiver.class); Log.d(TAG, "Got Intent"); /// I receive a log just before this portion but do not receive this one startActivity(PAintent); Log.d(TAG, "StartActivity(intent)"); PendingIntent mPendingIntent = PendingIntent.getActivity(getApplicationContext(), ALARMID, mintent, PendingIntent.FLAG_CANCEL_CURRENT); Log.d(TAG, "Got Pending intent"); AlarmManager mAlarm = (AlarmManager) getSystemService(ALARM_SERVICE); Log.d(TAG, "Got alarmmanager"); ///// remember to change time back to: (7 * 24 * 60 * 60 * 1000) mAlarm.setRepeating(AlarmManager.RTC_WAKEUP, ALARM_TIME.getTimeInMillis(), (30 * 1000), mPendingIntent); Log.d(TAG, "Made Pending intent"); ... } </code></pre> <p>keep in mind I renamed my intent, pendingintent, and alarm manager in this code for easier reading!</p> <p>I keep receiving a null pointer exception, my debug looks like this:</p> <pre><code>03-05 13:20:45.132: E/AndroidRuntime(12734): FATAL EXCEPTION: main 03-05 13:20:45.132: E/AndroidRuntime(12734): java.lang.NullPointerException 03-05 13:20:45.132: E/AndroidRuntime(12734): at android.content.ComponentName.&lt;init&gt;(ComponentName.java:75) 03-05 13:20:45.132: E/AndroidRuntime(12734): at android.content.Intent.&lt;init&gt;(Intent.java:2720) 03-05 13:20:45.132: E/AndroidRuntime(12734): at com.theStudyBuddy.Ignite.AlarmService.PlannerAssistantOn(AlarmService.java:148) 03-05 13:20:45.132: E/AndroidRuntime(12734): at com.theStudyBuddy.Ignite.EditScheduleActivity.saveClass(EditScheduleActivity.java:635) 03-05 13:20:45.132: E/AndroidRuntime(12734): at com.theStudyBuddy.Ignite.EditScheduleActivity.onClick(EditScheduleActivity.java:583) 03-05 13:20:45.132: E/AndroidRuntime(12734): at android.view.View.performClick(View.java:2485) </code></pre> <p>... and so on</p> <p>if anyone could point out my error it would be greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload