0

I have 2 activities.

In first activity there are some text fields and two buttons. In text fields I'm entering some data, and by clicking the first button I'm calling second activity that displays a ListView with checkboxes.

And from second activity after clicking a button over there I'm calling the first activity again. But by the time I move to that page, all data that have been entered earlier have disappeared.

I would need that data to reside even if I move back and forward between two activities.

harpun
  • 4,022
  • 1
  • 36
  • 40
user2879697
  • 69
  • 1
  • 10

2 Answers2

0

Just call activity2 with startActivityForResult method and from the activity2 when the button is clicked just call setResult() followed by finish and handle onActivityResult event in activity1, for more information you can refer this Android startActivityForResult and related post Handling result

Community
  • 1
  • 1
Jans
  • 11,064
  • 3
  • 37
  • 45
0

From Activity2, when clicking Button to go to Activity1 Simply on button.onClickListener Add this.finish();

And don't explicitly call the Activity1.

So your data wont be lost.

Amit Gupta
  • 8,914
  • 1
  • 25
  • 33