Reputation: 201
Recently I met a strange problem,I start a activity from a service,but if I follow the steps :
after above steps,the activity starts more slowly than normal way.Because I add a log in Activity's onCreate method.
normal way is same as above,except pressing home key.
Please help me solve it.Thanks.
Upvotes: 0
Views: 699
Reputation:
You can run the service and activity in different processes. I would also moving the logging into the service so it doesn't bind the UI. Use the process attribute for service in AndroidManifest.xml
Here's a snippit from the docs:
The name of the process where the service is to run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The element's process attribute can set a different default for all components. But component can override the default with its own process attribute, allowing you to spread your application across multiple processes.
Upvotes: 1
Reputation: 19290
If you started from the IDE, hit back, and then tapped the launcher icon, you will be starting another instance of your app. This might help explain things.
Upvotes: 0