How to update SimpleAdapter in Android

后端 未结 5 1222
死守一世寂寞
死守一世寂寞 2020-12-19 04:06

Is it possible to update a SimpleAdapter? I have a list of data and a footer that says \"See Next Results\" When that list item is clicked I capture the event and get new d

5条回答
  •  自闭症患者
    2020-12-19 04:41

    ListView lv= (ListView) findViewById(R.id.loglist);
    ArrayList> list = buildData();
    String[] from = { "time", "message" };
    int[] to = { R.id.logtime, R.id.logmessage };
    
    adapter = new SimpleAdapter(getApplicationContext(), list,R.layout.log_list_row, from,to);
    lv.setAdapter(adapter);
    

    Call this function each time to update the ListView. Keep in Mind that You have to update the list variable with new Data..

    Hope this Helps..:)

提交回复
热议问题