http://developer.android.com/intl/zh-TW/guide/practices/design/responsiveness.html
Why:
- No response to an input event (e.g. key press, screen touch) within 5 seconds
- A BroadcastReceiver hasn't finished executing within 10 seconds
Solution:
- any method that runs in the main thread should do as little work as possible
- Activities should do as little as possible to set up in key life-cycle methods such as onCreate() and onResume()
- Potentially long running operations should be done in a child thread, your main thread should provide a Handler for child threads to post back to upon completion
- your application should start a Service if a potentially long running action needs to be taken in response to an Intent broadcast
- avoid starting an Activity from an Intent Receiver

No comments:
Post a Comment