Showing Loading screen during REST service request in android app? -


currently here following, app launched, have send request rest service, take little time , thought of showing loading screen,

in oncreate() of activity , first thing show loading screen(progress dialog) , , kick off background activity using asynctask , i.e. requesting rest service , onpostexecute() close dialog , setcontentview(myxml); , update ui .

can approach improved ?

problem faced ,

sometimes , garbage collector may start(due various reasons) , app hangs @ loading screen forever , because of garbage collector , request rest service not sent , because of wake call comes , rest disaster , force close.

but forceclose doesnot come fast , may because of gc. cannot go , stuck in loading screen. thing can @ point come home. after if come app still loading , approach seems bad design. whats right approach ?

if expecting rest call take significant time, maybe should consider using service instead of async task. why? because on every orientation change, activity destroyed , new async task created again, rest call done again start. on other hand, when using service, can issue rest call once , trace it's status in activity (which requires handle onpause, oncreate functions).

i doubt problems have garbage collector - check stack trace after force close , try understand happens. must doing wrong...


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -