我们如何才能看到新元素被添加到电源适配器ListView中?
是新的elemnet获取通知toast消息
clientslist=new ArrayList<Client>();
ClientsAdapter adapterCL=new ClientsAdapter(getApplicationContext(), clientslist);
adapterCL.notifyDataSetChanged();
lvMain.setAdapter(adapterCL);
请帮助我亲爱的Stackoverfloww
答案 0 :(得分:0)
for(int i=0; i<response.length();i++)
{
Client client=new Client();
try {
JSONObject obj=response.getJSONObject(i);
client.setId(obj.getInt("id"));
client.setAdress(obj.getString("adress_client"));
client.setStatus(obj.getInt("status"));
client.setTell(obj.getString("phone_num"));
client.setNomeratsiya(String.valueOf(jay)+": ");
jay++;
clientslist.add(client);
} catch (JSONException e) {
try {
JSONObject js=new JSONObject(response.toString());
Log.d("js", js.getString("status"));
} catch (JSONException e1) {
e1.printStackTrace();
}
}
}
ClientsAdapter adapterCL=new ClientsAdapter(getApplicationContext(), clientslist);
adapterCL.notifyDataSetChanged();
lvMain.setAdapter(adapterCL);