title: Parsing JSON data & Load it in Fragments
body: <p>Excuse me  i already had an Application which Display my Sites articles and Novels in Android the codes in Main Activity to display  only one Section</p>
  
  <p>i create in the site 5 sections every section had a different content
  i Added items to Navigation Drawers and i defined the fragment and its connectivity   but the Problem in the Code i failed so
   i want to know how to load Data in 4 Fragments  </p>
  
  <p>RecyclerViewAdapter.class</p>
  
  <pre><code>import android.content.Context;
  import android.support.v7.widget.CardView;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.Toast;
  import com.squareup.picasso.Picasso;
  
  import java.util.List;
  
  
  public class RecyclerViewAdapter extends RecyclerView.Adapter&lt;RecyclerView.ViewHolder&gt; {
  
      private int previousPosition = 0;
      private List&lt;com.salim3dd.recyclerview_moredata.List_Item&gt; List_Item;
      private Context context;
  
      public RecyclerViewAdapter(List&lt;List_Item&gt; list_Item, Context context) {
          List_Item = list_Item;
          this.context = context;
      }
  
      @Override
      public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
  
          View menu1 = LayoutInflater.from(viewGroup.getContext()).inflate(
                  R.layout.row_item, viewGroup, false);
          return new MenuItemViewHolder(menu1);
  
      }
  
      @Override
      public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
  
          MenuItemViewHolder menuItemHolder = (MenuItemViewHolder) holder;
  
          menuItemHolder.TextName.setText(List_Item.get(position).getStory());
  
          Picasso.with(context).load(List_Item.get(position).getImg_link()).into(menuItemHolder.imageView);
  
          menuItemHolder.imageView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Toast.makeText(context, List_Item.get(position).getStory(), Toast.LENGTH_SHORT).show();
  
              }
          });
  
  
                  if (position &gt; previousPosition) { //scrolling DOWN
                      AnimationUtil.animate(menuItemHolder, true);
  
                  } else { // scrolling UP
  
                      AnimationUtil.animate(menuItemHolder, false);
                  }
                  previousPosition = position;
  
  
      }
  
  
      @Override
      public int getItemCount() {
          return (null != List_Item ? List_Item.size() : 0);
      }
  
      protected class MenuItemViewHolder extends RecyclerView.ViewHolder {
          private CardView cardView;
          private ImageView imageView;
          private TextView TextName;
  
          public MenuItemViewHolder(View view) {
              super(view);
              cardView = (CardView) view.findViewById(R.id.cardView);
              imageView = (ImageView) view.findViewById(R.id.imageView);
              TextName = (TextView) view.findViewById(R.id.TextName);
          }
      }
  
  }
  </code></pre>
  
  <p>MainActivity</p>
  
  <pre><code>    import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.support.v7.widget.GridLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.View;
  import android.widget.Toast;
  import com.android.volley.Request;
  import com.android.volley.RequestQueue;
  import com.android.volley.Response;
  import com.android.volley.VolleyError;
  import com.android.volley.toolbox.StringRequest;
  import com.android.volley.toolbox.Volley;
  import com.salim3dd.recyclerview_moredata.CheckInternetConnection;
  import com.salim3dd.recyclerview_moredata.List_Item;
  import com.salim3dd.recyclerview_moredata.R;
  import com.salim3dd.recyclerview_moredata.RecyclerViewAdapter;
  
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class MainActivity extends AppCompatActivity {
  
      private RecyclerView recyclerView;
      private RecyclerViewAdapter recyclerView_dAdapter;
      public List&lt;List_Item&gt; listItem = new ArrayList&lt;&gt;();
      private GridLayoutManager gridLayoutManager;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          recyclerView = (RecyclerView) findViewById(R.id.m_RecyclerView);
          recyclerView.setHasFixedSize(true);
  
          gridLayoutManager = new GridLayoutManager(this, 1);
          recyclerView.setLayoutManager(gridLayoutManager);
  
          recyclerView_dAdapter = new RecyclerViewAdapter(listItem, this);
          recyclerView.setAdapter(recyclerView_dAdapter);
  
          recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
              @Override
              public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
  
                  if (gridLayoutManager.findLastCompletelyVisibleItemPosition() == listItem.size() - 1) {
                      Get_All_Users(listItem.get(listItem.size()-1).getId());
                  }
  
              }
          });
  
          Get_All_Users(0);
      }
  
      public void Get_All_Users(int limit) {
  
          CheckInternetConnection cic = new CheckInternetConnection(getApplicationContext());
          Boolean Ch = cic.isConnectingToInternet();
          if (!Ch) {
              Toast.makeText(this, R.string.no_internet_connection, Toast.LENGTH_SHORT).show();
          } else {
  
              StringRequest stringRequest = new StringRequest(Request.Method.GET,
                      "Data Link" + limit
                      ,
                      new Response.Listener&lt;String&gt;() {
                          @Override
                          public void onResponse(String response) {
                              try {
                                  JSONArray jsonArray = new JSONArray(response);
                                  JSONObject jsonResponse = jsonArray.getJSONObject(0);
                                  JSONArray jsonArray_usersS = jsonResponse.getJSONArray("All_storys");
  
                                  for (int i = 0; i &lt; jsonArray_usersS.length(); i++) {
                                      JSONObject responsS = jsonArray_usersS.getJSONObject(i);
  
                                      int id = responsS.getInt("id");
                                      String story = responsS.getString("story_name");
                                      String img_link = responsS.getString("img_link");
  
                                      listItem.add(new List_Item(id, story, img_link));
  
                                  }
                                  recyclerView_dAdapter.notifyDataSetChanged();
  
  
                              } catch (JSONException e) {
                                  e.printStackTrace();
                              }
                          }
                      }, new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
  
                  }
              });
  
              RequestQueue queue = Volley.newRequestQueue(this);
              queue.add(stringRequest);
              stringRequest.setShouldCache(false);
  
  
          }
      }
  }
  </code></pre>
  
  <p>List Items.class</p>
  
  <pre><code>public class List_Item {
  
      public int id;
      public String story;
      public String img_link;
  
      public List_Item(int id, String story, String img_link) {
          this.id = id;
          this.story = story;
          this.img_link = img_link;
      }
  
      public int getId() {
          return id;
      }
  
      public String getStory() {
          return story;
      }
  
      public String getImg_link() {
          return img_link;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  }
  </code></pre>