i'm having a problem getting the json from pinterest it always error on the JSONArray part.
code
JSONArray bodyarray = null;
JSONParser jParser = new JSONParser();
JSONObject json = jParser.getJSONFromUrl(url);
Log.i("url",""+url);
Log.i("json",""+json);
try{
bodyarray = json.getJSONArray(TAG_body); <---- this is the error here "NullPointerException"
Log.i("JSON", ""+bodyarray);
I am getting a JSON array from server, something like:-
[{"0":"13177","id":"13177",other key value pairs},{another object with key value},{ other JSON objects}]
Now I am taking this as a string variable text(by input stream), and doing something like:-
jsonpropertyarray=new JSONArray(text.trim());//jsonproperty is JSONArray variable
I have a method in this class to return JSONArray:
pu
I have a problem. I don't set JSONArray to Spinner. My JSON look ["category1","category2","category3"]
How to get this JSONArray to spinner?
I'm writing an android app I use a background thread to pull a JSONArray from a web service. I then need to interact with that JSONArray inside the main activity.
I get following error:
Error parsing data org.json.JSONException: Value [] of type org.json.JSONArray cannot be converted to JSONObject
Here is the Android and PHP code I have:
private void eventUpdatePoint(String eventStatus,int lat,int lon){
JSONParser jsonParserEUP = new JSONParser();
try
{
List<NameValuePair> params = new ArrayList<NameValuePai
I made an activity "Messages" which is supposed to get JSON data from a given URL. I tried making a loop to print the json data, but the problem was somewhere else.
I have a server that returns some JSONArray by default, but when some error occurs it returns me JSONObject with error code.
I am using gridview for showing images as described here http://developer.android.com/guide/topics/ui/layout/gridview.html.
My adapter getView() method is:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
Log.i("count",""+1);
ImageView imageView;
ViewHolder holder = null;
if (convertVi
i want to access AmenityCodes you can see in the image for 0 position Amenity Codes is Array but on 49 positiin is json object so how to chek this is object or json array
MyActivity.java
for(int r=0;r<results.length();r++)
{
HashMap<String, String> map = new HashMap<String, String>();
hotelrating=results.getJSONObject(r).get(TAG_STARRATING).toString();
deepli