How to get image from gallery on fragment?
<p>I want to make a fragment that has function as if i push a button, and then gallery would be opened, and i choose a image, and that image would be put into my imageview.</p>

<p>I wrote code, </p>

<pre><code>public class GreenFragment extends Fragment {
    ImageView mImageview;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_green, container, false);
        mImageview = (ImageView) view.findViewById(R.id.iv_beforesendpost);

        view.findViewById(R.id.btn_getgallery).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int permissionCheck = ContextCompat.checkSelfPermission(getActivity(),
                        Manifest.permission.READ_EXTERNAL_STORAGE);

                if (permissionCheck == PackageManager.PERMISSION_GRANTED) {
                    startGallery();
                } else {
                    ActivityCompat.requestPermissions(getActivity(),
                            new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
                            2000);
                }
            }
        });
        return view;
    }

    private void startGallery() {
        Intent cameraIntent = new Intent(Intent.ACTION_GET_CONTENT);
        cameraIntent.setType("image/*");
        if (cameraIntent.resolveActivity(getActivity().getPackageManager()) != null) {
            startActivityForResult(cameraIntent, 1000);
        }
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == 1000 &amp;&amp; resultCode == Activity.RESULT_OK) {

        }
        Uri returnUri;
        returnUri = data.getData();

        Glide.with(this)
                .load(returnUri)
                .override(1280, 1280)
                .centerCrop()
                .crossFade()
                .into(mImageview);
</code></pre>

<p>But when i clicked <code>Button (btn_gatgallery)</code>, nothing happened.</p>

<p>Where is my fault? Please let me know.</p>