Have you ever tried to start a new activity from an class wich is not an activity itself? its not just getting the context and call the startActivity(..) method.

But, its not much more than that ๐Ÿ™‚ it is very simple if you know it ๐Ÿ˜€

You also have to create an Intent with an context. You can create the context for example in a separate class as follows:

From this class, you can use the applicationContext for your Intent.

Now create an intent and add a flag, to say that it is a new activity task and it will work. Without the flag, it won’t work.

 

Android: Start new Activity from a BroadcastReceiver or in another class which is not an Activity
Tagged on:

Leave a Reply

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers:

Welcome Damir Kusar

Log in

Lost your password?
%d bloggers like this: