content: package com.aminography.choosephotohelper.sample;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  import android.widget.ImageView;
  
  import androidx.annotation.NonNull;
  import androidx.annotation.Nullable;
  import androidx.fragment.app.Fragment;
  
  import com.aminography.choosephotohelper.ChoosePhotoHelper;
  import com.aminography.choosephotohelper.callback.ChoosePhotoCallback;
  import com.bumptech.glide.Glide;
  import com.bumptech.glide.request.RequestOptions;
  
  /**
   * @author aminography
   */
  public class UsedInFragmentFragment extends Fragment {
  
      private ChoosePhotoHelper choosePhotoHelper;
  
      @Nullable
      @Override
      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          return inflater.inflate(R.layout.fragment_used_in_fragment, container, false);
      }
  
      @Override
      public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
  
          final ImageView imageView = view.findViewById(R.id.imageView);
          final Button button = view.findViewById(R.id.button);
  
          choosePhotoHelper = ChoosePhotoHelper.with(this)
                  .asFilePath()
                  .withState(savedInstanceState)
                  .build(new ChoosePhotoCallback<String>() {
                      @Override
                      public void onChoose(String photo) {
                          Glide.with(imageView)
                                  .load(photo)
                                  .apply(RequestOptions.placeholderOf(R.drawable.default_placeholder))
                                  .into(imageView);
                      }
                  });
  
          button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  choosePhotoHelper.showChooser();
              }
          });
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          choosePhotoHelper.onActivityResult(requestCode, resultCode, data);
      }
  
      @Override
      public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
          super.onRequestPermissionsResult(requestCode, permissions, grantResults);
          choosePhotoHelper.onRequestPermissionsResult(requestCode, permissions, grantResults);
      }
  
      @Override
      public void onSaveInstanceState(@NonNull Bundle outState) {
          super.onSaveInstanceState(outState);
          choosePhotoHelper.onSaveInstanceState(outState);
      }
  
      public static UsedInFragmentFragment newInstance() {
          return new UsedInFragmentFragment();
      }
  
  }
  