android – How to launch a new activity using pending intent-ThrowExceptions

Exception or error:

Can anyone please say how to launch a new activity using pending intent and also to pass a value using pending intent.
Thanks in advance.

How to solve:
Intent intent = new Intent(getApplicationContext(), ActivityToLaunch.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);

You can add extra data into an Intent by using one of the various Intent.PutExtra() functions located:

Then, when you are ready to launch your PendingIntent, use one of the Send() functions located:

Leave a Reply

Your email address will not be published. Required fields are marked *