hi guys,
I am creating a application to simulate back key event in android, i
have implemented soft back key using the following code, it works
fine...
private void BackKeyPressed()
{
Context mcontext = this;
final Activity parent = (Activity) mcontext;
new Thread(new Runnable() {
public void run() {
simulateKeyStroke(KeyEvent.KEYCODE_BACK, parent);
}
}).start();
//return true;
}
private void simulateKeyStroke(int keyCode, Activity parent) {
injectKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, keyCode),
parent);
injectKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyCode),
parent);
}
private void injectKeyEvent(KeyEvent keyEvent, Activity parent)
{
parent.dispatchKeyEvent(keyEvent);
}
when i click on the back button in my app, it shows up the previous
activity what ever it is...
but what i want is my back key should display the previous activity -
1, i.e, i want to implement the back key functionality twice,
i don't want to have the back key on top of all the activities like as
a task bar or something...
just i have to launch one app with the back key, when i press that
key, it should close the current app and also the previous app....
i am thinking instead of passing activity parent, can i pass the
previous activity which ever it is,
by catching it from stack ? how to do that any idea's please ...
thanks in advance...................
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en