【问题标题】:listview sqlite "ListAdapter"listview sqlite“列表适配器”
【发布时间】:2013-07-23 21:29:37
【问题描述】:

我必须完成一个列表视图,我被卡住了,有人可以帮我吗? 我是初学者,看不懂“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 到底有什么你不明白的地方?

标签: listview listitem


【解决方案1】:

如果您花一些时间阅读开发人员站点中给出的 listView 的 API 和示例示例,那就更好了。您还可以参考 Vogella 代码库示例以获得基本实现和良好理解。Vogella tutorials page 这是链接: Android developer page

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-18
  • 1970-01-01
  • 2014-07-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多