Parsing a single row of JSON in android
<p>I am trying to create an app which parses a JSON and populates the listview. What I want is whenever an item is clicked the relevant data is parsed from the JSON. For example :</p>

<p>Activity 1:</p>

<p>contains a list of famous personalities </p>

<p>1 Mahatma Gandhi</p>

<p>2 Abraham lincoln</p>

<p>3 Nelson Mandela</p>

<p>4 Queen Elizabeth</p>

<p>Activity 2</p>

<p>Displays the Biography of the clicked item of listview. JSON for second activity contains a list of Biographies of the personalities</p>

<p>Now what I want to do is whenever an item of the listview is clicked the JSON of that particular item is parsed.Like if Mahatma Gandhi is clicked , then only the biography if Mahatma Gandhi i.e only the first row of the JSON array is fetched in the second activity</p>

<p><strong>EDIT</strong></p>

<p>MainActivity</p>

<pre><code>public class MainActivity extends AppCompatActivity {

    ListView lv;
    public ArrayList&lt;Person&gt; users;
    public RequestQueue requestQueue;
    String url = "http://www.humanfox.com/capsule/dash.php";
    NetworkImageView imageView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        lv = (ListView) findViewById(R.id.rv);
        imageView=(NetworkImageView)findViewById(R.id.imageView);
        LayoutInflater inflater = getLayoutInflater();

        ViewGroup header = (ViewGroup) inflater.inflate(R.layout.item2, lv,false);

        lv.addHeaderView(header);

        requestQueue = Volley.newRequestQueue(this);
        JsonObjectRequest jor = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;() {
            @Override
            public void onResponse(JSONObject response) {
                try{
                    JSONArray ja = response.getJSONArray("result");
                    users = Person.fromJson(ja);
                    lv.setAdapter(new CustomAdapter(MainActivity.this, users));
                }
                catch(JSONException e){e.printStackTrace();}
            }
        },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Log.e("Volley", "Error");

                    }
                }
        );
        // Access the RequestQueue through your singleton class.
        MySingleton.getInstance(this).addToRequestQueue(jor);

        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView&lt;?&gt; a, View v, int position,
                                    long id) {

                Intent intent = new Intent(MainActivity.this, caps1.class);

                startActivity(intent);
            }
        });

    }


}
</code></pre>

<p>When the item is clicked on the listview how do I set an onclicklistener so that it parses the the row no. of Json similar to the id of the listview clicked .E.g
if the item no. 3 is clicked on the listview . row no. 3 of the json is parsed in the 2nd activity </p>