How is thread priority managed in Android? (Or what is the threading policy in Android?) GUI threads would be assigned higher priority, right?
I’ve seen applications that create separate thread to clean up (native) resources since finalize() is discouraged. However, there is still memory leak (or memory inefficiency) since the cleanup thread is not running frequently enough.
Some other apps, those ignoring the advice on not to use finalize(), rely on the finalizer to clean up resources. So I’m wondering how is the finalizer thread scheduled? Is it a reliable way to release resources, either managed or native?
I would strongly recommend you to use AsyncTask for doing something in different thread. AsyncTask is very easy to use and I would say that it is one of the biggest advantages of java. I really miss it in obj-c.
Async task got method
in which you can clean whatever you want after thread done it’s job.
http://labs.makemachine.net/2010/05/android-asynctask-example/
http://marakana.com/s/video_tutorial_android_application_development_asynctask_preferences_and_options_menu,257/index.html
Links with tuts about AsyncTask.
About priority: threads in android are threads in java, and they have priority from 0 to 10.
You can set them for each thread as you would like.
And about
you should avoid using this method. As I already said u should better use AsyncTask class instead of Thread.