我必須完成一個listview,我卡住了,有人可以幫助我嗎? 我是初學者,我無法理解「ListAdapter」listview sqlite「ListAdapter」
感謝
private void lista(){
SQLiteDatabase db = new MioDbHelper(this).getReadableDatabase();
String sql = "SELECT nome_utente_pc, password_pc, note_pc FROM Password";
Cursor c = db.rawQuery(sql, null);
ListAdapter adapter = new ArrayAdapter<>(this, R.layout.dettaglio_lista_pc){
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = super.getView(position, convertView, parent);
TextView tvUtente, tvPass, tvNote;
tvUtente = (TextView) row.findViewById(R.id.tv_utente_pc);
tvPass = (TextView) row.findViewById(R.id.tv_password_pc);
tvNote = (TextView) row.findViewById(R.id.tv_note_pc);
}
};
lista.setAdapter(adapter);
}
究竟是什麼,你不明白關於ListAdapter? – emecas