Thanks you so much for this clarification ,,exactly I want to make an application that keeps running while the user may went of the main application ,,and I guess Service will be the best candidate for doing that ,,,,,,,
But what if the application will take much time ,,so should I make a thread that embedded inside it a Service?? On Sun, Jun 13, 2010 at 7:35 PM, Olivier Guilyardi <l...@samalyse.com>wrote: > On 06/13/2010 06:23 PM, Olivier Guilyardi wrote: > > On 06/13/2010 03:46 PM, tarek.attia wrote: > >> I have a question what to Use ,Service Or Thread,as both run in the > >> background > > > > There is confusion here, because you are referring to two different > meanings of > > the word "background". > > > > A thread, in Java but also in many other languages, allows for > parallelization > > within a single program/process, that is: doing several things at the > same time. > > If your program has a GUI and needs to do something heavy then you need > to do it > > in the "background" and thus within a separate thread, to avoid freezing > the UI. > > But this thread will terminate when your program terminates. > > > > A service, in Android, is something which runs even when the application > is not > > in the foreground, that is: it continues to run when the user leaves your > > activity and returns to home, or when the phone goes to sleep. If you > don't need > > this then you don't need a service. > > One thing that I forgot: if you need to have something to keep on running > while > the user goes from one of your activities to the other, then you may also > need a > service. > > But the best would be that you explain what you are trying to do. > > > As you may see, "background" here means something quite different, > because a > > service never runs in a dedicated /thread/. By default it runs in the > main > > application thread, and may optionally run in a separate /process/: > > http://developer.android.com/intl/fr/reference/android/app/Service.html > > -- > Olivier > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- tarek -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en