Right now I have an alarm on my main activity which launches a class which launches a notification on the status bar. When I click on the notification, it opens up my main activity, now I want it to open a n specific view within that activity.

This is my notification code.

String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns); int icon = android.R.drawable.stat_notify_chat; // icon from resources CharSequence tickerText = "TickerText"; // ticker-text long when = System.currentTimeMillis(); // notification time CharSequence contentTitle = "My notification"; // message title CharSequence contentText = "Hello World!"; // message text //This is the intent to open my main activity when the notification is clicked final Intent notificationIntent = new Intent(context, mainActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); // the next two lines initialize the Notification, using the configurations above Notification notification = new Notification(icon, tickerText, when); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); mNotificationManager.notify(notifID, notification);

This is the button in the layout used by my main activity which opens the view I want the notification to open (graph view).

<Button android:id="@+id/graphsButton" android:layout_width="100dp" android:layout_height="100dp" android:layout_below="@id/reviewButton" android:layout_toRightOf="@id/medicineButton" android:onClick="openGraphs" android:text="Graphs" />

When you click on the button. It executes the following method in the main class.

public void openGraphs(View v) { canExit = false; setContentView(R.layout.graphs); }

So basically, I got the notification to open the app and launch the main activity, but I want it to launch the graph view directly.

Can anybody help me?