Pending Intent in Android -


Constructor of a pending intention requires an intent object in the next activity from the next subject. In my app, I have only one activity that includes several scenes. I have no other activity.

Thoughts are destroyed or appear on demand. Obviously I can not add a scene to the creator of an intent, so how do I direct pending intentions? & lt; Include / & gt; Using the command, many ideas are main. Has been included in Xml. This is very easy to complete. Mvnpavan has already given you a good hint, you just need to do some extra work. First of all you are familiar with this page. should be there. It explains how to manage your app tasks and go back to the stack. In your case you have 2 options:

1. In the launch, launch launch launch property. Since using your single activity, SingleTop should be set up.

  & amp; Activity Activity: Name = "com.yourpackage.YourClass" Android: launchMode = "singleTop" & gt; & Lt; / Activity & gt;  

2. Add flag FLAG_ACTIVITY_SINGLE_TOP to your intent (which you are passing to a pending agent):

Intent = intent (new, new meaning) (YourActivity.class ); Intent.addFlags ( Intent.FLAG_ACTIVITY_SINGLE_TOP );

Please note that in both cases, you can apply callback method of activity to a newantant (). Use it when you want to do some extra work, when the app is brought back to the foreground.

Update:

will use the service to keep the connection to the server, not the activity then whatever you can do with your activity This is the best practice if you worry that activity has no direct access to the service API, then you can connect to that service. Take a look at this page. You can copy / paste the code and you are done. It is very easy to maintain, in the future you may need to create another activity for which a connection to the server is required. This will save you a lot of time and headache :)


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -