Two or More Activities in android -


I am using the button in main activity. When I click on this button it will be for another activity. My question is ... When I click on the button, it should not display another activity window. For example, in my case when I click on the button Then it will start another activity and in that activity I have added the functionality to get the notification. Here's what I want when I clicked the button then I get the notification Ahia and it should reflect the activity window I can do this ..? I can do this functionality to get notification in onclick. But I do not want this way. I need two activities ... Anyone can suggest how to do this.

[Clarifying Text].

In my first act, I had a button when I clicked that button, she would start a new activity ..

  intent = intent (new, new activity); StartActivity;  

In this second activity I added the code to get the notification.

Now my question is that when I click on the button in the first activity then a new window will be displayed as I am starting another activity .. what i want i wont get a new window I want to display .. but I have to get the notification ..

I really can not understand I am what you are asking, but I think one of them solves it Should:

1) When the button is clicked to use the intents, open the activity: onClick ():

  intent = intent (new intent) , Second activity class); StartActivity;  

This requires that you add another activity as an activity in the app manifest file.

2) If you want to open another activity only when it receives notification, use a service, then when you get a notification, bring the service to the foreground, but It will happen (unless you turn it off), in the app not only your own.


Comments