1

Let's say I got a fragment page called "A" and "B" and an activity called "C". When I click the add button in Fragment B, it will takes the user to activity C. When the user input all the information in activity B and press submit, it will take the user back to fragment B and reload it.

My situation is I use the finish() function on "C" while I press the submit but when it go back to the fragment B it doesn't refresh.

My code:

 private View.OnClickListener mSubmitButtonOnClick = new View.OnClickListener(){ @Override public void onClick(View v) { if(getArray() != null) { insertRecord(getArray()); finish(); } else{ Toast.makeText(AddClaimFormPage.this, "Please select at least one item to claim.", Toast.LENGTH_SHORT).show(); } } }; 

Please help, how can I reload the fragment B when I used finish()?

2 Answers 2

1

You need to override the onResume() on fragment B:

@Override public void onResume() { super.onResume(); // Load data and do stuff } 

Refer Fragment Lifecycle for more details.

Sign up to request clarification or add additional context in comments.

Comments

0

you have to manage stake of fragment and when you back from another activity to previous activity than load fregment which is the top on stack.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.