title: android value passing from fragment to fragment using recyclerview not working
body: <p>I am developing an app i want to pass value from one fragment to another fragment. Here i am using Recyclerview Adapter. My code is shown below.</p>
  
  <p>FriendsFragment.java</p>
  
  <pre><code>public class FriendsFragment extends android.support.v4.app.Fragment {
  
  List&lt;GetDataAdapter&gt; GetDataAdapter1;
  RecyclerView recyclerView;
  RecyclerView.LayoutManager recyclerViewlayoutManager;
  RecyclerView.Adapter recyclerViewadapter;
  
  String GET_JSON_DATA_HTTP_URL = "http://192.168.43.7/work/ecom/2/1.php";
  String JSON_IMAGE_TITLE_NAME = "image_title";
  String JSON_IMAGE_URL = "image_url";
  String JSON_IMAGE_ID = "id";
  
  JsonArrayRequest jsonArrayRequest ;
  RequestQueue requestQueue ;
  public FriendsFragment() {
      // Required empty public constructor
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.fragment_friends, container, false);
  
      GetDataAdapter1 = new ArrayList&lt;&gt;();
      recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview1);
      recyclerView.setHasFixedSize(true);
      recyclerViewlayoutManager = new LinearLayoutManager(getContext());
      recyclerView.setLayoutManager(recyclerViewlayoutManager);
  
  
  
  
  
  
      JSON_DATA_WEB_CALL();
  
  
  
      // Inflate the layout for this fragment
      return rootView;
  }
  
  public void JSON_DATA_WEB_CALL(){
  
      jsonArrayRequest = new JsonArrayRequest(GET_JSON_DATA_HTTP_URL,
  
              new Response.Listener&lt;JSONArray&gt;() {
                  @Override
                  public void onResponse(JSONArray response) {
  
                      Log.d("LOGTAG", "Response :"+response);
  
                      JSON_PARSE_DATA_AFTER_WEBCALL(response);
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
  
                  }
              });
  
      requestQueue = Volley.newRequestQueue(getContext());
  
      requestQueue.add(jsonArrayRequest);
  }
  
  
  public void JSON_PARSE_DATA_AFTER_WEBCALL(JSONArray array){
  
      for(int i = 0; i&lt;array.length(); i++) {
  
          GetDataAdapter GetDataAdapter2 = new GetDataAdapter();
  
          JSONObject json = null;
          try {
  
              json = array.getJSONObject(i);
  
              GetDataAdapter2.setImageTitleNamee(json.getString(JSON_IMAGE_TITLE_NAME));
  
              GetDataAdapter2.setImageServerUrl(json.getString(JSON_IMAGE_URL));
  
              GetDataAdapter2.setImageId(json.getString(JSON_IMAGE_ID));
  
          } catch (JSONException e) {
  
              e.printStackTrace();
          }
          GetDataAdapter1.add(GetDataAdapter2);
      }
  
      recyclerViewadapter = new RecyclerViewAdapter(GetDataAdapter1, getContext());
  
      recyclerView.setAdapter(recyclerViewadapter);
  
  }
  
  @Override
  public void onAttach(Activity activity) {
      super.onAttach(activity);
  }
  
  @Override
  public void onDetach() {
      super.onDetach();
  }
  }
  </code></pre>
  
  <p>RecyclerViewAdapter.java</p>
  
  <pre><code>public class RecyclerViewAdapter extends RecyclerView.Adapter&lt;RecyclerViewAdapter.ViewHolder&gt; {
  
  static String categoryId;
  Context context;
  List&lt;GetDataAdapter&gt; getDataAdapter;
  ImageLoader imageLoader1;
  
  private final View.OnClickListener mOnClickListener = new MyOnClickListener();
  public RecyclerViewAdapter(List&lt;GetDataAdapter&gt; getDataAdapter, Context context){
      super();
      this.getDataAdapter = getDataAdapter;
      this.context = context;
  }
  
  @Override
  public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.recyclerview_items, parent, false);
      v.setOnClickListener(mOnClickListener);
      ViewHolder viewHolder = new ViewHolder(v);
          return viewHolder;
  }
  @Override
  public void onBindViewHolder(ViewHolder Viewholder, int position) {
      GetDataAdapter getDataAdapter1 =  getDataAdapter.get(position);
      Viewholder.ImageTitleNameView.setText(getDataAdapter1.getImageTitleName());
      imageLoader1 = ServerImageParseAdapter.getInstance(context).getImageLoader();
      imageLoader1.get(getDataAdapter1.getImageServerUrl(),
              ImageLoader.getImageListener(
                      Viewholder.networkImageView,//Server Image
                      R.mipmap.ic_launcher,//Before loading server image the default showing image.
                      android.R.drawable.ic_dialog_alert //Error image if requested image dose not found on server.
              )
      );
  
      Viewholder.networkImageView.setImageUrl(getDataAdapter1.getImageServerUrl(), imageLoader1);
  }
  
  @Override
  public int getItemCount() {
      return getDataAdapter.size();
  }
  
  class ViewHolder extends RecyclerView.ViewHolder{
  
      public TextView ImageTitleNameView;
      public TextView imageid;
      public NetworkImageView networkImageView ;
      public CardView cardView ;
      public ViewHolder(final View itemView) {
          super(itemView);
          ImageTitleNameView = (TextView) itemView.findViewById(R.id.textView_item) ;
          networkImageView = (NetworkImageView) itemView.findViewById(R.id.VollyNetworkImageView1);
          cardView = (CardView) itemView.findViewById(R.id.cardview1);
          itemView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  int pos = getAdapterPosition();
                  Bundle bundle=new Bundle();
                  bundle.putString("message", "From Activity");
                  MessagesFragment fragobj=new MessagesFragment();
                  fragobj.setArguments(bundle);
  
              }
          });
      }
  }
  
  private class MyOnClickListener implements View.OnClickListener {
      @Override
      public void onClick(View v) {
          GetDataAdapter getDataAdapter = new GetDataAdapter();
          TextView textView = (TextView) v.findViewById(R.id.textView_item) ;
      }
  }
  }
  </code></pre>
  
  <p>GetAdapter.java</p>
  
  <pre><code>public class GetDataAdapter {
  
  public String ImageServerUrl;
  public String ImageTitleName;
  public String ImageId;
  
  public String getImageServerUrl() {
      return ImageServerUrl;
  }
  
  public void setImageServerUrl(String imageServerUrl) {
      this.ImageServerUrl = imageServerUrl;
  }
  
  public String getImageTitleName() {
      return ImageTitleName;
  }
  
  public void setImageTitleNamee(String Imagetitlename) {
      this.ImageTitleName = Imagetitlename;
  }
  
  public String getImageId() {
      return ImageId;
  }
  
  public void setImageId(String ImageId) {
      this.ImageId = ImageId;
  }
  
  }
  </code></pre>
  
  <p>SampleHolder.java</p>
  
  <pre><code>public class SampleHolder extends RecyclerView.ViewHolder {
  public SampleHolder(View itemView) {
      super(itemView);
  }
  }
  
   when i using
                  Bundle bundle=new Bundle();
                  bundle.putString("message", "From Activity");
                  //set Fragmentclass Arguments
                  MessagesFragment fragobj=new MessagesFragment();
                  fragobj.setArguments(bundle);
  </code></pre>
  
  <p>it is not passing value to message fragment or not going to message fragment.</p>
  
  <p>How it possible plese help me.</p>