vendredi 31 octobre 2014

spinner values not displaying in android


Vote count:

0




Hi In This code first two values showing data and from third string array it giving null pointer Exception but data coming from database.can any one please help me.


This values only showing NullPointerException



patient_main_type_name[i] = JA.getJSONObject(i).getString("patient_main_type_name");
patient_type_name[i] = JA.getJSONObject(i).getString("patient_type_name");
religion_name[i] = JA.getJSONObject(i).getString("religion_name");
caste_name[i] = JA.getJSONObject(i).getString("caste_name");


class file



String result = DatabaseUtility.executeQueryPhp("getpatient","");
System.out.print(result);

try
{
JSONArray JA = new JSONArray(result);



initial_name = new String[JA.length()];
initial_id = new String[JA.length()];
patient_main_type_name = new String[JA.length()];
patient_type_name = new String[JA.length()];
religion_name= new String[JA.length()];
caste_name= new String[JA.length()];



for(int i=0;i<JA.length();i++)
{
initial_name[i] = JA.getJSONObject(i).getString("initial_name");
initial_id[i] = JA.getJSONObject(i).getString("initial_id");
patient_main_type_name[i] = JA.getJSONObject(i).getString("patient_main_type_name");
patient_type_name[i] = JA.getJSONObject(i).getString("patient_type_name");
religion_name[i] = JA.getJSONObject(i).getString("religion_name");
caste_name[i] = JA.getJSONObject(i).getString("caste_name");
}

spinner_fn();


}


catch(Exception e)
{
Log.e("Fail 3", e.toString());
}


asked 20 secs ago

user

10






spinner values not displaying in android

Aucun commentaire:

Enregistrer un commentaire