android - ANR Exception handling -


i have application, providing remote ui(which contains buttons control media server).

the problem when click of button, executing corresponding action, long upnp network operation.

so when press buttons continuously , device comes anr exception , force close application. made research on anr exception , found that, can use thread or asynctask solve problem.

but in application since providing many buttons, when user presses buttons continuously , may inturn lead lot of threads created in application.

please give me suggestions on this.

how overcome problem?

thanks

one of many advantages of using asynctask manages threading (and thread pooling) you. if use asynctask, shouldn't have problem of creating many threads.

in addition, if you're concerned creating many asynctasks, consider putting tasks in member variable (such queue or arraylist) , keeping track of state. if 1 still processing might not necessary start another. or can remove tasks results no longer needed.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -