Я создаю одно приложение, в котором я запрашиваю файл PHP с сервера. Этот PHP файл возвращает JSONArray с JSONObjects как его элементы, например,
[
{
"uniqid":"h5Wtd",
"name":"Test_1",
"address":"tst",
"email":"[email protected]",
"mobile":"12345",
"city":"ind"
},
{...},
{...},
...
]
мой код:
/* jArrayFavFans is the JSONArray i build from string i get from response.
its giving me correct JSONArray */
JSONArray jArrayFavFans=new JSONArray(serverRespons);
for (int j = 0; j < jArrayFavFans.length(); j++) {
try {
if (jArrayFavFans.getJSONObject(j).getString("uniqid").equals(id_fav_remov)) {
//jArrayFavFans.getJSONObject(j).remove(j); //$ I try this to remove element at the current index... But remove doesn't work here ???? $
//int index=jArrayFavFans.getInt(j);
Toast.makeText(getParent(), "Object to remove...!" + id_fav_remov, Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Как удалить определенный элемент из этого JSONArray?