Question: I want to implement the thread in my application 

first requirement is: 

Each activity access the local database that time it take some time to load.So I am planning to give progress-dialog.I want to do it in thread.Currently I did using the `AsynsTask` because of I dodnt know how long will take for record. Other than `AsynsTask` How we can implement using Thread?

Multitasking Facility :

I want to run two activity.One is in background.I.E If there are any upload available(Database Syn Android to SQL Server) while running activity ,Upload should start in background.How we can implement this?

Please guide me on this

Thanks in advance

Answer: 
You want to synchronize your database in background so I think you have to use `service` in which you have to implement `thread` and you have to write your code in thread.

You can then `schedule your service startup time` and also `you can repeat your service` when ever you want to keep duration for start service.

**And for upload you have to options** 

1) Using `AysncTask`

2) Using `Service with thread` 

**And also know that Service is running in main UI so if you want to use service for synchronize database you have to implement thread**
you can execute many `AsyncTask`s in the background, but only one `Activity` can be active at a single time.

`AsyncTask` handles the threading for you.