Saturday, June 19, 2010

[android-developers] Mimic Home button in software

I would like the back button to work exactly like the home button in
my activity. I know that doesn't sounds like something I would want to
do, but it makes sense in the context of my app.

I've tried an intent:
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
But this doesn't work the same way.
I've tried super.onKeyDown(KeyEvent.KEYCODE_HOME, event); on the
onKeyDown method and it does nothing.

They problem is the keyguard acts different when you push the home
button when you have an unlock pattern set.
There is usually a "Emergency Call" button on the unlock pattern
screen, but there is not when you click the home button and you have
dismissed the keyguard.
I would like the back button to behave the same way.

Would I be able to do this with the instrument class? Is there a
better way to do it?

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment