简体   繁体   中英

When I use a Bound Service in Android, does it run in the background, on its own thread or on the main UI thread?

I am searching through a dictionary in my app, and because it may takes some time, and involves searching through 170,000+ items, and inserting usually about 100 items into a database, etc..., I am trying to make it not hog the main thread. I have read conflicting things about bound services. Do they run on their own thread, or do I have to manually do that in the service? Basically, what do I have to do to run it in the background? I thought this was the whole point of a bound service. Any help would be greatly appreciated!

您可以使用AsyncTask类,或者如果不想在ui线程上启动新线程,则可以启动它

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM