Monday, April 8, 2013

[android help] Activity Start slowly

android - Activity Start slowly - Stack Overflow




















Recently I met a strange problem,I start a activity from a service,but if I follow the steps :


  1. enter a app

  2. press home key to go back launcher

  3. then trigger the service to start my activity

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.





























You can run the service and activity in different processes. 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.
























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.




















default







.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...