I'm making an app with tab layout. Inside app I have two activities. One activity have 30 items and I'm marking/unmarking them by pressing a button. Inside second activity only marked items are shown (I've got two listviews and I'm passing an array which contains numbers of items that are marked). And here's the problem, let's say I have marked 2 items in my First activity, I'm going to the Second and everything works fine, but when I go back and mark 2 new items, nothing happens in my second activity. I know why, I'm "making" my items inside oncreate method and when I'm in First activity my second goes onPause. So I thought to finish that activity, but here's the problem When I write something like:
@Override
protected void onPause() {
Second.this.finish();
super.onPause();
}
It shuts down whole app, how to finish only the second activity so it could call oncreate method each time it's open again ? Thanks for help
You should not finish that activity. Once you marked new items store their states (marked/unmarked) in DB or files or whatever, once your second is about to start, you will need load the items and filter them by marked, so you will get a list of marked items.