0

I have 2 activities.

  • ActivityA : i use ImagePickerActivity from poly-picker library to select multi files and send paths to ActivityB

  • ActivityB : each file, i create one view and add to relative layout programmatically.

But my problem is when i press back button, ActivityB not finish, it recreate itself. number of recreate times is equal to number of files.

Pls, help, thanks and sorry about English.

phamxuanlu
  • 303
  • 1
  • 5
  • 12

2 Answers2

0

When you press the back button, the Activity gets destroyed. So, when the activity is started again, it recreates itself.

Bidhan
  • 10,607
  • 3
  • 39
  • 50
  • i see, but i want back to ActivityA from ActivityB when i press back button on ActivityB. But it does not, it recreate ActivityB – phamxuanlu May 16 '15 at 06:38
0

Override onBackPressed() in ActivityB

public void onBackPressed() {
    ActivityB.this.finish();
}
Exigente05
  • 2,161
  • 3
  • 22
  • 42