0

I have a intent to a third party map app. And actually I need the navigation activity, but in order to start the navigation, the map app needs to start a main map activity first. So when I quit the navigation activity, it goes back to the map. I'd like to fire the back event twice when the back button is pressed in the navigation activity.

How to do this? I can only do something in my own code, the map app is a third part app.

Joey.Z
  • 4,492
  • 4
  • 38
  • 63
  • This probably won't work, but did you try calling `super.onBackPressed();` twice in overriden onBackPressed ? :) – Cԃաԃ Jul 24 '13 at 09:25

1 Answers1

1

Maybe try sth like this, but i dont know if there is a better way to do this..

@Override
public void onBackPressed()
{
    setResult(42);
    finish();
    ....

and:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
    if (resultCode == 42)
    {
        finish();
....
Matthias H
  • 1,300
  • 13
  • 19
  • You can add a Flag to the Intent: i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); So your Second Activity is ignored because it is not in the History Stack. But you can't send a Result back to your first activity.. you would have to add a Flag in the 3rd party App..(i.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);) – Matthias H Jul 24 '13 at 10:42