private void show2() { Cursor c = personService.getCursotScrollData(0, 20); @SuppressWarnings("deprecation") SimpleCursorAdapter adapter = new SimpleCursorAdapter( this, R.layout.item, c, new String[] {"name", "age", "phone"}, new int[] {R.id.name, R.id.age, R.id.phone}); listView.setAdapter(adapter); }
private void show() { List<Person> persons = personService.getScrollData(0, 20); List<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>(); for (Person person : persons) { HashMap<String, Object> item = new HashMap<String, Object>(); item.put("name", person.getName()); item.put("age", person.getAge()); item.put("phone", person.getPhone()); item.put("id", person.getId()); data.add(item); } SimpleAdapter adapter = new SimpleAdapter( this, data, R.layout.item, new String[] {"name", "age", "phone"}, new int[] {R.id.name, R.id.age, R.id.phone}); listView.setAdapter(adapter); }
private void show3() { List<Person> persons = personService.getScrollData(0, 20); PersonAdapter adapter = new PersonAdapter(this, persons, R.layout.item); listView.setAdapter(adapter); }