I am fetching data from mysql using php API and i pass results to android with Json_encode
but when i populate results to android
You have initialized collection in wrong place, Please have look at following code this may help you
ArrayList> wordList;
wordList = new ArrayList>();
for (int i = 0; i < response.length(); i++) {
try {
JSONObject jObj = new JSONObject(response);
boolean error = jObj.getBoolean("error");
// Check for error node in json
if (!error) {
// user successfully exist in database
JSONObject user = jObj.getJSONObject("user");
String paid_amount = user.getString("paid_amount");
String parking_duration =
user.getString("parking_duration");
String parking_name = user.getString("parking_name");
HashMap prodHashMap = new
HashMap();
prodHashMap.put("paid_amount", paid_amount);
prodHashMap.put("parking_duration", parking_duration);
prodHashMap.put("parking_name", parking_name);
wordList.add(prodHashMap);
;
progressBarList.setVisibility(View.GONE);
}
userList = wordList ;
ShowListData()