So I’m trying to start a new activity from my onReceive function in a `BroadcastReceiver, yet I seem to be crashing. Without further adieu here is the code:
public void onReceive(Context context, Intent intent) {
//... other stuff that's not relevant
Intent j = new Intent(context, myClass.class);
context.startActivity(j);
//If I comment the above two lines out and replace with a Toast, the toast shows up
}
Thoughts?
Edit – did some more testing, and I can start this activity from other places using the same kind of intent. I just can’t do it from the BroadcastReceiver…
Thanks.
Try this: