Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An easy adapter to map JSON data to views defined in an XML layout

branch: master

Merge pull request #1 from pyro2927/master

Allowing strings to be pulled from nested JSONObjects
latest commit 03a032c305
Jeff Gilfelt authored
Octocat-spinner-32 res first commit August 18, 2011
Octocat-spinner-32 src Allowing strings from nested JSONObjects March 24, 2013
Octocat-spinner-32 .classpath update for tools r14 October 30, 2011
Octocat-spinner-32 .gitignore first commit August 18, 2011
Octocat-spinner-32 .project first commit August 18, 2011
Octocat-spinner-32 AndroidManifest.xml first commit August 18, 2011
Octocat-spinner-32 LICENSE first commit August 18, 2011
Octocat-spinner-32 README.markdown Edited README.markdown via GitHub August 23, 2011
Octocat-spinner-32 proguard.cfg first commit August 18, 2011
Octocat-spinner-32 project.properties update for tools r14 October 30, 2011
README.markdown

JSONArrayAdapter

An easy adapter to map JSON data to views defined in an XML layout.

Basically a drop-in replacement for and wrapper around android.widget.SimpleAdapter that maps data from a org.json.JSONArray instance.

Usage:

ListAdapter adapter = new JSONArrayAdapter(this,
                data,                                                   // JSONArray data                           
                android.R.layout.simple_list_item_2,                    // a layout resource to display a row
                new String[] {"from_user", "text"},                     // field names from JSONObjects
                new int[] {android.R.id.text1, android.R.id.text2},     // corresponding View ids to map field names to 
                "id"                                                    // id field from JSONObjects (optional)
);

getListView().setAdapter(adapter);

The code in this project is licensed under the Apache Software License 2.0.

Copyright (c) 2011 readyState Software Ltd.

Something went wrong with that request. Please try again.