0

During research I found this code.

public boolean onKeyDown(int keyCode, KeyEvent event)  
    {
         if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)
         {
            this.moveTaskToBack(true);

            return true;
         }
        return super.onKeyDown(keyCode, event);
    }

Calling Activity like this

Intent i = new Intent(this, ActivityTwo.class);
                                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                i.putExtra("IN_ROOMID", roomId);
                                i.putExtra("IN_USERID", from);
                                startActivity(i);

But above code minimize entire application that I don't want actually.

What is my requirement?

Suppose I have two activities say ActivityOne.java and ActivityTwo.java.

ActivityOne -> calls -> ActivityTwo

If I press back button in ActivityTwo it should be minimize and ActivityOne should resume.

Hos to achieve this. Thanks. Biraj Zalavadia.

Biraj Zalavadia
  • 28,348
  • 10
  • 61
  • 77

1 Answers1

1

As, there is no concept of minimize explicitly. you can make ActivityOne single instance, and from ActivityTwo, start ActivityOne, ActivityTwo by default will go in background (minimized). what say you?

Farhan
  • 13,290
  • 2
  • 33
  • 59