Android controller in different thread

I´ve heared that the main Activity should run in a different thread than the actual program. Whats the best practice there, where should I start a new thread. I have a controller that starts and organizes some stuff, should I run the controller already in a different thread?

Answers


The point to know is that all callbacks in an Activity run on the UI thread, and you should not do any lengthy work on the UI thread. Otherwise, you will compromise the responsiveness of the UI and possibly cause an ANR.

If you need to do any kind of lengthy operation, like some serious number crunching, downloading data from a remote server that involves making blocking calls, etc. then you should perform it on a new, non-UI thread.


ANR = Application Not Responding ;-)


Need Your Help

Query by age in hql

java sql hibernate datetime hql

I have a class User with one field called birthDate which is a java.sql.Date.

How to draw an Qwt plot into an image

c++ qt qwt

I'd like to overlay a graph over a video stream, i.e. a QImage within a custom widget. How would I go about drawing the Qwt plot to a surface other than a Qwt Plot?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.