简体   繁体   中英

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 service (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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM