My debugging point is not going from this line
JSONArray jsonArray=jsonObj.getJSONArray(""); but exception is caught in
Catch in this code..
JSONArray jsonArray=jsonObj.getJSONArray("");
int length = jsonArray.length();
System.out.println("jsonObj:"+jsonObj);
System.out.println("jsonarray:"+jsonArray);
String[] str1 = new String[length];
for (int i = 0; i < str1.length; i++) {
str1[i]=jsonArray.getJSONObject(i).getJSONObject("FORM").getJSONArray("FPROP").getJSONObject(0).getString("FNAME");
}
On Sat, Aug 4, 2012 at 11:22 AM, Meena Rengarajan <[email protected]>wrote:
> I do not understand what mistake here ? please anyone can help me ? This
> is my code..
>
> String result=getIntent().getStringExtra("Entry");
> result = result.substring(result.indexOf('#')+1);
> //String JsonData;
> String resultJSON=getIntent().getStringExtra("JsonData");
> try {
> JSONObject jsonObj=new JSONObject(resultJSON);
> //str1=json1.getString("UploadResult");
> JSONArray jsonArray=jsonObj.getJSONArray("");
> int length = jsonArray.length();
> System.out.println("jsonObj:"+jsonObj);
> System.out.println("jsonarray:"+jsonArray);
> String[] str1 = new String[length];
> for (int i = 0; i < str1.length; i++) {
>
> str1[i]=jsonArray.getJSONObject(i).getJSONObject("FORM").getJSONArray("FPROP").getJSONObject(0).getString("FNAME");
>
> }
> } catch (Exception e) {
> // TODO: handle exception
> //Toast.makeText(NewActivity.this,"sorry", Toast.LENGTH_LONG).show();
> }
> ArrayAdapter<String> adapter = new
> ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,
> android.R.id.text1,str1);
>
> lv.setAdapter(adapter);
>
> On Saturday, August 4, 2012 10:36:18 AM UTC+5:30, Meena Rengarajan wrote:
>>
>> This is my code. Listview using Json in Android . But my lists is not
>> displaying when i click a button.. Only displaying first activity alone.
>> Whats wrong here ? can anyone help me ..
>> try {
>> JSONObject json1=new JSONObject(resultJSON);
>> JSONArray jsonArray=json1.getJSONArray("**");
>> int length = jsonArray.length();
>> System.out.println("json1:"+**json1);
>> System.out.println("**jsonarray:"+jsonArray);
>> String[] str1 = new String[length];
>> for (int i = 0; i < str1.length; i++) {
>> str1[i]=jsonArray.**getJSONObject(i).**getJSONObject("FORM").**
>> getJSONArray("FPROP".**getJSONObject(0).getString("**FNAME");
>>
>> }
>> } catch (Exception e) {
>> // TODO: handle exception
>> Toast.makeText(NewActivity.**this,"sorry", Toast.LENGTH_LONG).show();
>> }
>> ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,**
>> android.R.layout.simple_list_**item_1, android.R.id.text1,str1);
>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en