0

Please tell me how can I implement a return from the activity to the fragment that called it in Android Studio. This is a part of the code of my fragment.

Intent intent = new Intent(getContext(), HelpActivity.class);
startActivity(intent);

Code of my activity:

public class HelpActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_1);
       
    }

}
luska
  • 23
  • 6
  • https://stackoverflow.com/questions/17085729/startactivityforresult-from-a-fragment-and-finishing-child-activity-doesnt-c – ADM Apr 22 '21 at 09:23

1 Answers1

0

What I think you are looking for is communication from Activity to a fragment or vice versa so there are many ways like you can implement interface or you can use concept of shared view model.

Please check this answer : Communicating between a fragment and an activity - best practices

Jasvir
  • 71
  • 6