How to implement onActivityResult within RecyclerView Fragment
<p>I am trying to have a button within a Tab which is part of an activity for uploading images, when clicking the button inside one of the 2 Tabs presented in the activity ( Tab 1 pics, Tab 2 Vid ) the user could choose an image from the device.</p>

<p>My problem is implemneting the onClick Listener and onActivityResult which is not being used when placed after onClick, plus the @Override is being underlined as an error.</p>

<p>I guess i am not implementing the onClick the right way and not sure how to activate onActivityResult the proper way, i would appreciate any guidance;</p>

<p>MainActivty;</p>

<pre><code>   public class upload extends AppCompatActivity {

public String UserID;
private static final int REQUEST_SIGNUP = 0;

private DrawerLayout mDrawerLayout;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.upload);
    Firebase.setAndroidContext(this);

    // Adding Toolbar to Main screen
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Setting ViewPager for each Tabs
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(viewPager);
    // Set Tabs inside Toolbar
    TabLayout tabs = (TabLayout) findViewById(R.id.tabs);
    tabs.setupWithViewPager(viewPager);
 }
  private void setupViewPager(ViewPager viewPager) {
    Adapter adapter = new Adapter(getSupportFragmentManager());
    adapter.addFragment(new UploadPictures(), "Pictures");
    adapter.addFragment(new UploadVideos(), "Videos");
    viewPager.setAdapter(adapter);
}

static class Adapter extends FragmentPagerAdapter {
    private final List&lt;Fragment&gt; mFragmentList = new ArrayList&lt;&gt;();
    private final List&lt;String&gt; mFragmentTitleList = new ArrayList&lt;&gt;();

    public Adapter(FragmentManager manager) {
        super(manager);
    }

    @Override
    public Fragment getItem(int position) {
        return mFragmentList.get(position);
    }

    @Override
    public int getCount() {
        return mFragmentList.size();
    }

    public void addFragment(Fragment fragment, String title) {
        mFragmentList.add(fragment);
        mFragmentTitleList.add(title);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mFragmentTitleList.get(position);
    }
}
</code></pre>

<p>And here is the Fragment Code;</p>

<pre><code>   public class UploadPictures extends android.support.v4.app.Fragment {
   @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    final RecyclerView recyclerView = (RecyclerView) inflater.inflate(
            R.layout.recycler_view, container, false);
   ContentAdapter adapter = new ContentAdapter(recyclerView.getContext());
    recyclerView.setAdapter(adapter);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    return recyclerView;

}

 public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

    public ImageView picture;
    public EditText tagEditText;
    public Button tagCurLoc, choosePic, uploadContent;


    public ViewHolder(LayoutInflater inflater, ViewGroup parent) {
        super(inflater.inflate(R.layout.pictue_upload, parent, false));

        picture = (ImageView) itemView.findViewById(R.id.imgToUpload);
        tagEditText = (EditText) itemView.findViewById(R.id.tagEditText);
        tagCurLoc = (Button) itemView.findViewById(R.id.tagCurLoc);
        choosePic = (Button) itemView.findViewById(R.id.choosePic);
        choosePic.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(galleryIntent, RESULT_LOAD_IMAGE);

            }

            protected void onActivityResult(int requestCode, int resultCode, Intent data) {
                if (data == null) {
                    onActivityResult(requestCode, resultCode, data);
                    Toast.makeText(getActivity().getApplicationContext(), "Canceled ", Toast.LENGTH_SHORT).show();


                } else {
                    if (requestCode == RESULT_LOAD_IMAGE) {
                            Uri selectedImgPath = data.getData();
                            picture.setImageURI(selectedImgPath);
                            RealFilePath = Uri.parse(String.valueOf(selectedImgPath));
                            Toast.makeText(getActivity().getApplicationContext(), " " + RealFilePath, Toast.LENGTH_SHORT).show();
                    }
                }
            }
        });

        uploadContent = (Button) itemView.findViewById(R.id.uploadContent);
    }
}



/**
 * Adapter to display recycler view.
 */
public class ContentAdapter extends RecyclerView.Adapter&lt;ViewHolder&gt; {
    // Set numbers of List in RecyclerView.

    private Context mContext;

    public ContentAdapter(Context context) {

        this.mContext = context;
    }



    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(LayoutInflater.from(parent.getContext()), parent);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, int position) {

    }

    @Override
    public int getItemCount() {
        return LENGTH;
    }

}
</code></pre>

<p>Not sure if the onClick listener for the button should be implemented in the Adapter or the View holder, and from there the issue of onActivityResult cant be used ?</p>