Answer the question
In order to leave comments, you need to log in
How to match records in ListView and database?
I can’t figure out how to match the id of the records in the ListView and in the database.
ArrayList<Map<String,Object>> data=new ArrayList<Map<String, Object>>(
type.size());
Map<String,Object>m;
for (int i=0;i<type.size();i++){
m=new HashMap<String, Object>();
m.put("type", type.get(i));
m.put("sum", sum.get(i));
data.add(m);
}
//массив имен Spend, Profit
String[]from={"type","sum"};
int[] to={R.id.tvType,R.id.tvSum};
SimpleAdapter simpleAdapter=new SimpleAdapter(this,data,R.layout.item1,from,to);
lvData=(ListView)findViewById(R.id.lvData);
lvData.setAdapter(simpleAdapter);
lvData.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question