title: Android:Getting a value recyclerview item value without using `getAdapterPosition()`
body: <p>I have a recyclerview that populate the json data which is coming from an api.
  Here are the items in each recylerview item <code>project_id</code>,<code>title</code>,etc, with each recyclerview i have <strong>checkbox</strong> associated with it.</p>
  
  <p>Here is the code for populating the data in recyclerview.</p>
  
  <pre><code>for (int j = 0, count = data.length(); j &lt; count; j++) {
       String name = json.getString(TAG_PROJECT_ID);
                       PROJECT_ID.add(name);
                       Log.e("array id added",name);
                       String name1 = json.getString(TAG_PROJECT_TITLE);
                      PROJECT_TITLE.add(name1);
  }
  </code></pre>
  
  <p>when click on the checkbox on each recyclerviewitem i want to get the <code>project_id</code> of the corresponding item.</p>
  
  <pre><code>//click listener
   mCheck.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                           //GET THE PROJECT ID
                         }
  )}
  </code></pre>
  
  <p><strong>UPDATED THE ACTUAL CODE</strong> 
  (for simplicity ,i had added only relevant code here )
  My Recyclerview adapter</p>
  
  <pre><code> public class FavouriteManager extends RecyclerView.Adapter&lt;FavouriteManager.RecyclerViewHolder&gt; {
   ArrayList&lt;String&gt; PROJECT_ID;
          ArrayList&lt;String&gt; PROJECT_TITLE;
   @Override
          public RecyclerViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
              v1 = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.recyclerview_item, viewGroup, false);
              return new RecyclerViewHolder(v1);
          }
  
          @Override
          public void onBindViewHolder(final RecyclerViewHolder viewHolder, int i) {
   projecttitle = PROJECT_TITLE.get(i);
   viewHolder.mProjectName.setText(projecttitle);
   @Override
          public int getItemCount() {
              SharedPreferences pref = getContext().getSharedPreferences("MirSP", Context.MODE_PRIVATE);
              set = pref.getStringSet("FAV", null);
              if (set != null) {
                  selected = new ArrayList&lt;String&gt;(set);
                  Log.e("Item Added", "");
              } else {
                  selected = new ArrayList&lt;String&gt;();
              }
              Length = selected.size();
              if (Length == 0) {
                  RelativeLayout IMG = (RelativeLayout) getActivity().findViewById(R.id.fav_img);
                  IMG.setVisibility(View.VISIBLE);
              }
  
              return Length;
          }
   public class RecyclerViewHolder extends RecyclerView.ViewHolder {
  TextView mProjectName;
  CheckBox mCheck;
  
              RecyclerViewHolder(final View itemView) {
                  super(itemView);
                  mProjectName = (TextView) itemView.findViewById(R.id.PROJECT_name);
   mCheck = (CheckBox) itemView.findViewById(R.id.PROJECT_fav);
   mCheck.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
  int h = getAdapterPosition();
                          if (!offlinejson.equals("")) {
                              try {
                                  JSONObject jsonObject = new JSONObject(offlinejson);
                                  JSONArray data = jsonObject.getJSONArray(TAG_DATA);
                                  JSONObject jsondata = data.getJSONObject(h);
                                  Log.e("getCheckedPos(getID)", String.valueOf(jsondata));
                                  check = PROJECT_ID.get(h);
                                  Log.e("getCheckedPos(getID)", String.valueOf(jsondata));
                                  if (selected.contains(check)) {
                                      selected.remove(check);
                                      mCheck.setBackgroundResource(R.drawable.ic_favorite_white1_24dp);
                                      Snackbar snackbar = Snackbar.make(v, "Property Unfavorited", Snackbar.LENGTH_SHORT);
                                      snackbar.show();
                                      notifyItemRemoved(h);
                                      Log.e("FOUND","found");
                                  }
   } catch (JSONException e) {
                                  e.printStackTrace();
                              }
        }
                  });
  try {
                          JSONObject jsonObject = new JSONObject(offlinejson);
                          JSONArray data = jsonObject.getJSONArray(TAG_DATA);
                          PROJECT_ID = new ArrayList&lt;String&gt;();
                          PROJECT_TITLE = new ArrayList&lt;String&gt;();
  
                          for (int j = 0, count = data.length(); j &lt; count; j++) {
                              json = data.getJSONObject(j);
                              //JSONArray jsonArray = new JSONArray(json);
                            //  Log.e("JSON", String.valueOf(json));
  
                              if (selected.contains(String.valueOf(json.get(TAG_PROJECT_ID)))) {
                                  try {
                                      String name = json.getString(TAG_PROJECT_ID);
                                      PROJECT_ID.add(name);
                                      Log.e("array id added",name);
                                      String name1 = json.getString(TAG_PROJECT_TITLE);
                                      PROJECT_TITLE.add(name1);
   } catch (JSONException e) {
                                      e.printStackTrace();
                                  }
                              }
                          }
  
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>Note:
  I don't want use getAdapterPosition() method because its not applicable with my json structure.</p>