Asynchronous service call while starting the activity in android
I am starting an activity from one by passing some data in the intent. I want the next activity to call some asynchronous servi开发者_JS百科ce (rest service) with the data from intent and show the result on screen.
I made the asynchronous call by starting a different thread from onStartup method. But this is failing with below error:
: INFO/ProductAdvertisingAPIOperation(290): done requesting and parsing
: WARN/ActivityManager(73): Launch timeout has expired, giving up wake lock!
: INFO/Process(290): Sending signal. PID: 290 SIG: 9
: INFO/WindowManager(73): WIN DEATH: Window{43f64a28 com.zzzz.android.xxxx.main/com.zzzz.android.xxxx.main.HomeScreen paused=false}
: INFO/WindowManager(73): WIN DEATH: Window{43ffe9b8 com.zzzz.android.xxxx.main/com.zzzz.android.xxxx.main.CameraView paused=false}
: INFO/UsageStats(73): Unexpected resume of com.android.launcher while already resumed in com.zzzz.android.xxxx.main
: WARN/InputManagerService(73): Got RemoteException sending setActive(false) notification to pid 290 uid 10034
Does anybody know the reason? Thanks
I changed my code to not start the aysnc call in onCreate/onResume/OnStartup. Seems Android has some timeout for UI thread for 5 seconds, beyond which it throws 'Application Not Responding' message. In my case it was failing to load since this was happening on activity startup. So I am calling the async call afte rthe activity is started, onButtonclicked.
Thanks Nayn
精彩评论