29
March
2013
Hello
Still me, yet my V. Matteo trainee who have questions (in January).
Another way to achieve this is simple also, just when the activity is paused to launch a service (say StayHereActivity) and killing activity (finish).
Intent startActivitiesCops = new Intent (this, ActivtiesCopsService.class);
startService (startActivitiesCops);
super.onPause ();
Finish();
The service itself, does that restart activity:
public int onStartCommand (Intent intent, int flags, int startId) {}
Log.e ("ActivtiesCopsService", "onStratCommand");
Intent startMain = new Intent (ActivtiesCopsService.this, MainActivity.class);
startMain.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity (startMain);
stopSelf();
Return Service.START_STICKY;
}
Y' has not even need permission.
Thank you who? Thanks Android2EE
And don't forget the Android2EE formations to become ultimate on Android:
Comprehensive training Android
Soon, I hope.
Mathias Séguy
This email address is being protected from spambots. You need JavaScript enabled to view it.
Founder Android2EE
Training - Expertise - Consulting Android.
EBooks learn programming Android.
You must be connected to post a comment.