I want to keep my 开发者_如何转开发activity
on TOP always.
I need to get my Activity
called to TOP in every 5 sec.( not re-create).
I used Timer
, but not able to do so.
Please help me. If possible provide some code also.
I don't like the idea of forcing an opening of an Activity
. It will get uninstalled from my phone and reported in the market :).
To do that you will need to use BroadCastReceiver and the AlarmManager.
The idea is to set an alarm with the AlarmManager
and when it's fired your BroadCastReceiver
will use context.startActivity();
to start your Activity
.
Don't forget to make your BroadCastReceiver
listen for android.intent.action.BOOT_COMPLETED
. This way you can bother the user after the booting finishes :)
精彩评论