public class MainActivity extends AppCompatActivity { private ListView listView; private SimpleAdapter simpleAdapter; private List personinfo; Test test; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); test = new Test(this); listView = (ListView) findViewById(R.id.list); personinfo=new ArrayList(); simpleAdapter = new SimpleAdapter(this, getpersoninfo(), R.layout.item, new String[]{"pic", "text","age","sex"}, new int[]{R.id.pic, R.id.word,R.id.age,R.id.sex}); listView.setAdapter(simpleAdapter); } public Person[] getperson() { Person[] persons=new Person[100]; int i=0; SQLiteDatabase db=test.getReadableDatabase(); Cursor cursor=db.rawQuery("select * from info",null); if(cursor!=null&&cursor.getCount()>0){ while (cursor.moveToNext()){ Person person=new Person(); person.setName(cursor.getString(1)); person.setSex(cursor.getString(2)); person.setAge(cursor.getString(3)); person.setImage(cursor.getString(4)); persons=person; i++; } } cursor.close(); test.close(); return persons; } public List getpersoninfo(){ Person[] persons=getperson(); for(int i=0;i |