title: how to filter json object by String value in android?
body: <p>I have view pager with fragment in recyclerview i want to parse json data based on value pair in first fragment i want to all data if device is online and second data  based on offline value any suggestion would  be appreciated.
  My Json Value.</p>
  
  <pre><code>[
  {
      "deviceId": "IVIS1475",
      "siteName": "IVIS1475    SBI-CHE-Coimbatore-Kangeyampalayam",
      "deviceStatus": "Offline",
      "hddStatus": "Ok",
      "powerSource": "Battery"
  },
  {
      "deviceId": "IVIS1354",
      "siteName": "IVIS1354    SBI-Trichy S.P Office Pudukottai",
      "deviceStatus": "Offline",
      "hddStatus": "Ok",
      "powerSource": "Battery"
  },
  {
      "deviceId": "IVIS1476",
      "siteName": "IVIS1476    SBI-Coimbatore Redfields Coimbatore",
      "deviceStatus": "Offline",
      "hddStatus": "Ok",
      "powerSource": ""
  },
  {
      "deviceId": "IVIS1355",
      "siteName": "IVIS1355    SBI-CHE-Pondicherry-Thiruvandarkoil Busstand",
      "deviceStatus": "Online",
      "hddStatus": "Not Ok",
      "powerSource": ""
  },
  {
      "deviceId": "IVIS1597",
      "siteName": "IVIS1597    SBI-Chennai 1 Melvisharam Vellore",
      "deviceStatus": "Online",
      "hddStatus": "Ok",
      "powerSource": "Mains"
  },
  {
      "deviceId": "IVIS2203",
      "siteName": "IVIS2203    SBI-Coimbatore Kutchery Strt Udamalpet",
      "deviceStatus": "Online",
      "hddStatus": "Ok",
      "powerSource": "Battery"
  },
  {
      "deviceId": "IVIS1478",
      "siteName": "IVIS1478    SBI-Coimbatore Officers Club ",
      "deviceStatus": "Offline",
      "hddStatus": "Ok",
      "powerSource": "Battery"
  },
  {
      "deviceId": "IVIS2205",
      "siteName": "IVIS2205    SBI-Coimbatore Municipal Cmplx Udamalpet",
      "deviceStatus": "Offline",
      "hddStatus": "Ok",
      "powerSource": "Battery"
  },
  {
      "deviceId": "IVIS2206",
      "siteName": "IVIS2206    SBI-Coimbatore Railway Station Tirupur",
      "deviceStatus": "Offline",
      "hddStatus": "Not Ok",
      "powerSource": "Battery"
  },
  {
      "deviceId": "IVIS2207",
      "siteName": "IVIS2207    SBI-Coimbatore Dr Nanjappa Rd Coimbatore",
      "deviceStatus": "Online",
      "hddStatus": "Not Ok",
      "powerSource": "Battery"
  }]
  </code></pre>
  
  <p>Based on device status i want to filter json data and add into recyclerivew this my recyclerveiw code.</p>
  
  <pre><code>RequestQueue requestQueue = Volley.newRequestQueue(getContext());
  
      StringRequest stringRequest = new StringRequest(Request.Method.GET, projectDetailUrl, new Response.Listener&lt;String&gt;() {
          @Override
          public void onResponse(String response)
          {
  
  
                 progressBar.setVisibility(View.GONE);
  
                 GsonBuilder builder = new GsonBuilder();
                 Gson mGson = builder.create();
                 posts =new ArrayList&lt;&gt;(Arrays.asList(mGson.fromJson(response, ProDetail[].class)));
  
                 adapter = new OnSiteAdapter( posts);
                 recyclerView.setAdapter(adapter);
                 final List&lt;ProDetail&gt; finalPosts = posts;
                 ItemClickSupport.addTo(recyclerView).setOnItemClickListener(
                         new ItemClickSupport.OnItemClickListener()
                         {
                             @Override
                             public void onItemClicked(RecyclerView recyclerView, int position, View v) {
                                 // do it
                                 String deviceId = finalPosts.get(position).getDeviceId();
                                 Intent proDetailIntent = new Intent(getContext(), SensorDetailAcitivity.class);
                                 proDetailIntent.putExtra("deviceid", deviceId);
                                 startActivity(proDetailIntent);
  
  
                             }
                         }
                 );
  
             }
  
  
  
      }, new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error)
          {
              progressBar.setVisibility(View.GONE);
              Toast.makeText(getActivity(), "Something went wrong", Toast.LENGTH_SHORT).show();
  
          }
      });
      requestQueue.add(stringRequest);
  </code></pre>