FAQ Database Discussion Community


Android Beam json file

android,json,nfc,android-json,android-beam
I have a simple activity that launches a file chooser and then sends the file via Android beam like so: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode==0 && resultCode==RESULT_OK) { adapter.setBeamPushUris(new Uri[] {data.getData()}, this); Button btn=new Button(this); btn.setText("Done"); btn.setOnClickListener(this); setContentView(btn); } } The activity is...

How to set image path on image view in android

android,image,android-layout,android-json
I have the following code in which i am getting id , name and image path. i want to show that image path in image view. public class AllProductsActivity extends ListActivity { String pid; private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList<HashMap<String, String>> productsList;...

How to convert JSONArray to arraylist

android,arraylist,android-json
i have JSONArray(not JSONObject) , content of this array looks like :...

org.jsonexception value of type org.jsonobject cannot be converted to jsonarray

php,android,android-json
exception : org.json.JSONException: Value{"id":"6","assignment":";Array","rollno":",Array","subject":"TE_DBMS_PRAC","late":";Array"} of type org.json.JSONObject cannot be coverted to JSONArray my android code is try { JSONArray jsonArray=new JSONArray(result); //arrayList.clear(); for(int i=0;i<jsonArray.length();i++){ JSONObject jsonObject=null; jsonObject=jsonArray.getJSONObject(i); rolno = jsonObject.getString("rollno"); assign=jsonObject.getString("assignment"); late=jsonObject.getString("late");...

Index out of bound exception in Android app

android,android-fragments,android-listview,android-json
Hi in my android application I need to display a some details in list view based upon the date. When u open the application it get get data for the last Ten days and display that. This application was working fine in few days back but now its showing some...

My json is appearing as a HTML when parsed (android)

android,html,json,android-json
I'm trying to parse and get the values from a URL with JSON format. The format of the JSON when the URL is used in a browser is shown below: {"CompanyID":"1","Message":"Not active user","Success":"false","UserID":"2"} My JsonParser code is shown below: import android.util.Log; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import...

How do I loop through this JSON object?

javascript,jquery,json,android-json
main.php jQuery code: $.getJSON('posts.php',function(data){ data.posts.forEach(function(post){ // set variables and append divs to document }) data.comments.forEach(function(post){ // set variables and append divs to document }) }) (Old - Works with current jQuery code) Example object containing 2 posts and 3 comments. Post with id: 5 has 1 comment and post id:...

Json wont response my array in php

php,android,mysql,json,android-json
I am trying to fetch multiple rows from my database and then encode them with json so I can access them in my Android application. I've successfully encoded an object but I couldn't find a way to do the same with an array. My code looks like: if ($tag ==...

Android parse json get org.json.JSONException error

android,json,android-json
String jsonStr = HelperInputStream.convertInputStreamToString(inputStream); if (jsonStr == null) { return; } String code,message = ""; try { JSONObject object = new JSONObject(jsonStr); Log.e("code:" , object.getString("subject")); jsonStr result is: [{"code":"1","subject":"you have new message"}] unfortunately i get this error is catch: org.json.JSONException: Value [{"subject":"you have new message","code":"1"}] of type org.json.JSONArray cannot...

GSON parse HashMap to List with same positions

android,gson,android-json
For example i have json: { "1" : {...}, "5" : {...}, "2" : {...} } I want to parse it to List with same element positions: So element with id = "1" will be in List on 0 position, with id="5" on 1 position, and with id="2" on 2...

Getting JSON Exception no value for?

json,android-json
I am trying to handle the json response, that is like {"Status":true,"UserId":111,"FirstName":"dev","LastName":"dev","Gender":-1,"BirthdayDate":"0000-00-00","Phone":"","ProfilePicture":"","ProfilePicture60px":"","ProfilePicture120px":"","CountryId":-1,"Email":"droidwithmxxmail.com","Password":"******123","RegisterDate":"2015-05-08 20:08:07","SessionId":"fce248fe6499b7a9338a1b64554509eb77841"} but getting org.json.JSONException: no value for exception My code is this. if (jsonStr != null) { try { JSONObject jsonObj = new...