title: How to show details from my web service to recycler view
body: <p>hi i try to show some details from my web service to recycler view ,i can take the other details except the images to my recyclerview.Pls help me</p>
  
  <p><strong>My fragment is:</strong> </p>
  
  <pre><code>     public class MainActivityFragment extends Fragment {
        private static final String TAG = "RecyclerViewExample";
        private final List&lt;Person&gt; mPersonList = new ArrayList&lt;&gt;();
        public MainActivityFragment() {
        }
  
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_main, container, false);
  
          Context context = getActivity();
  
  
          RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
          recyclerView.setHasFixedSize(true);
  
          LinearLayoutManager layoutManager = new LinearLayoutManager(context);
          recyclerView.setLayoutManager(layoutManager);
  
          final RVAdapter rvAdapter = new RVAdapter(mPersonList);
          recyclerView.setAdapter(rvAdapter);
  
          RequestQueue requestQueue = Volley.newRequestQueue(context);
          String url = "http://onam.leah.in/new/item_details.php";
  
          JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(url, new    Response.Listener&lt;JSONArray&gt;() {
              @Override
              public void onResponse(JSONArray response) {
                  try {
  
  
                          for (int i = 0; i &lt; response.length(); i++) {
                              Log.d(TAG, response.toString());
                              JSONObject jsonObject = response.getJSONObject(i);
  
  
  
                              String phone_name = jsonObject.getString("Phone");
  
  
                           String phone_price = jsonObject.getString("Price");
                              String thumbnail=jsonObject.getString("Image");
  
                              Person person=new Person(phone_name,phone_price,thumbnail);
  
                              mPersonList.add(i, person);
                          }
                          rvAdapter.notifyDataSetChanged();
  
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  Log.e("VOLLEY", error.toString());
              }
          });
  
          requestQueue.add(jsonArrayRequest);
  
  
          return view;
      }
  }
  </code></pre>
  
  <p><strong>my person class is</strong> </p>
  
  <pre><code> class Person {
          public String phone_name;
          public String phone_price;
          public String thumbnail;
  
           Person(String phone_name, String phone_price,String thumbnail) {
             this.phone_name = phone_name;
             this.phone_price = phone_price;
             this.thumbnail=thumbnail;
  
         }
         }
  </code></pre>
  
  <p><strong>adapter class is</strong> </p>
  
  <pre><code>public class RVAdapter extends
      RecyclerView.Adapter&lt;RVAdapter.PersonViewHolder&gt; {
          List&lt;Person&gt; persons; //    private Context mContext;
          private ImageLoader mImageLoader;
  
          RVAdapter(List&lt;Person&gt; persons) {
              this.persons = persons;
          }
  
          @Override
          public PersonViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
              View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview,
      parent, false);
              PersonViewHolder pvh = new PersonViewHolder(v);
              return pvh;
          }
  
          @Override
          public void onBindViewHolder(PersonViewHolder holder, int position) {
  
              mImageLoader = AppController.getInstance().getImageLoader(); //       
      holder.thumbnail.setImageUrl(persons.get(position).thumbnail,
      mImageLoader);
              holder.phoneName.setText(persons.get(position).phone_name);
              holder.phonePrice.setText(persons.get(position).phone_price);
              if (mImageLoader == null)
                  mImageLoader = AppController.getInstance().getImageLoader();
              holder.thumbnail.setImageUrl(persons.get(position).thumbnail,
      mImageLoader);
          }
  
          @Override
          public int getItemCount() {
              if (persons != null) {
                  return persons.size();
              }
              return 0;
          }
  
          @Override
          public void onAttachedToRecyclerView(RecyclerView recyclerView) {
              super.onAttachedToRecyclerView(recyclerView);
          }
  
          public static class PersonViewHolder extends RecyclerView.ViewHolder {
              CardView cv;
              TextView phoneName;
              TextView phonePrice;
            NetworkImageView thumbnail;
  
              PersonViewHolder(View itemView) {
                  super(itemView);
                  cv = (CardView) itemView.findViewById(R.id.card_view);
                  phoneName = (TextView) itemView.findViewById(R.id.phone_name);
                  phonePrice = (TextView) itemView.findViewById(R.id.phone_price);
                  thumbnail=(NetworkImageView) itemView.findViewById(R.id.thumbnail);
              }
          }
  </code></pre>
  
  <p>while am runing the app i got error as:</p>
  
  <pre><code> java.lang.NullPointerException: Attempt to invoke virtual method 'com.android.volley.toolbox.ImageLoader harico.mylastrecycle.AppController.getImageLoader()' on a null object reference
              at harico.mylastrecycle.RVAdapter.onBindViewHolder(RVAdapter.java:39)
              at harico.mylastrecycle.RVAdapter.onBindViewHolder(RVAdapter.java:20)
              at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:5138)
              at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4433)
              at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4326)
              at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1955)
              at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1364)
              at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1327)
  </code></pre>