Well @Fencer300,
Simply make a simple bean class (Model class with getter setter methd )
// make a city bean class
public class cityModel implements Serializable {
private String fajr;
// do for more same ass
public String getFajr() {
return fajr;
}
public void setFajr(String fajr) {
this.fajr= fajr;
}
}
protected void outputTimings(JSONArray jsonArray) {
String[] prayers = {"fajr", "shurooq", "dhuhr", "asr", "maghrib",
"isha"};
cityModel cityObj;
try {
cityObj= new cityModel();
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject cityObject =
jsonArray.getJSONObject(i);
// for(int z=0; z < cityObject.length(); z++) {
cityObj.setFajr(""+cityObject.getString("fajr"))
// do for more same as
}
}
Note easily now you can use fajr value , do for same foe all
2
solved Confused on how to make variable in class? [closed]