Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Follow this Steps:</p> <p><strong>1</strong>. Create bean class of the getters and setters methods.</p> <p><strong>2</strong>. Create a ArrayList.</p> <p><strong>3</strong>. Store the values into bean class.</p> <p><strong>4</strong>. Add the bean class object into arraylist.</p> <p><strong>5</strong>. Now, On the click of the listview item, pass the bean class object using <code>putExtra</code>.</p> <p>Go this way.</p> <p><strong>EDIT:</strong></p> <p>Bean Class:</p> <pre><code> public class ActivitiesBean implements Serializable{ /** * */ private static final long serialVersionUID = 1L; public String title; public String image; ........ public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } .............. } </code></pre> <p>Java class:</p> <pre><code> ActivitiesBean bean; ArrayList&lt;Object&gt; listActivities = new ArrayList&lt;Object&gt;(); ............................ public class FetchActivitesTask extends AsyncTask&lt;Void, Void, Void&gt; { int i =0; @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pgb.setVisibility(View.VISIBLE); } @Override protected Void doInBackground(Void... params) { // TODO Auto-generated method stub ............ Here your JSON code for (i = 0; i &lt; jsonnodes.length(); i++) { JSONObject jsonnode = jsonnodes.getJSONObject(i); JSONObject jsonnodevalue = jsonnode.getJSONObject(node); bean = new ActivitiesBean(); bean.title = jsonnodevalue.getString(title); bean.image = jsonnodevalue.getString(image_fid); ..................... listActivities.add(bean); } } catch (JSONException e) { e.printStackTrace(); } return null; } @Override public void onPostExecute(Void result) { // TODO Auto-generated method stub super.onPostExecute(result); pgb.setVisibility(View.GONE); displayAdapter(); } } public void displayAdapter() { adapter = new ActivityAdapter(this, listActivities); contests_listView.setAdapter(adapter); contests_listView.setOnItemClickListener(new OnItemClickListener() { //@Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long id) { bean = (ActivitiesBean) adapter.getItem(position); Intent in1 = new Intent(Activites_Activity.this, Activity_display.class); in1.putExtra("ActivityObject", bean); startActivity(in1); } }); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload