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 ?
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
.