Can’t we launch an activity from a service ? If so, will the service keep running in background in a separate thread and the launched activity in foreground as a separate thread ?
Asked
Active
Viewed 1,056 times
0
-
Possible duplicate : http://stackoverflow.com/questions/3606596/android-start-activity-from-service – Haresh Chhelana Dec 05 '14 at 11:58
1 Answers
2
Can’t we launch an activity from a service ?
You can call startActivity()
on a Service
or any other Context
.
If so, will the service keep running in background in a separate thread and the launched activity in foreground as a separate thread ?
In Java, objects do not run on threads. Methods run on threads. The fact that the activity was launched from a service does not affect this at all. Pretty much everything with both an Activity
and a Service
by default occurs on the main application thread, and that too does not change because the Service
launched an Activity
.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
-
1@SteveJobs: In Java, objects do not run on threads. Methods run on threads. – CommonsWare Dec 05 '14 at 12:07
-
Thatz ok but I require launching activity as a separate thread, any other method ?? – Avinesh Dec 05 '14 at 12:10