开发者

cannot display layout after using camera activity

I have 开发者_开发百科a beginner's question: in my app I need to call a camera activity for results. In the method onActivityResult I do a lot of processing on the image just taken before by calling the camera activity. During the execution of the onActivityResult I would like to display a Layout (including a progressbar) but I can't. The screen stays black until the method finishes all image processing tasks. Should I use threads to inflate the layout while image processing is done in the onActivityResult method ? What's the best way to do it?

Thank you


You have to use multithreading because onActivityResult() is executed on what is called the UI thread, that is the main and "default" thread. If that processing you do is too long, you get the infamous ANR dialog (Application Not Responding).

Android's solution to this is AsyncTask. This article should introduce you to this practice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜