Using SimpleCursorAdapter with Spinner?

前端 未结 3 1183
终归单人心
终归单人心 2021-01-13 12:24

I have a db with table \"mytable\" having 2 colums \"id\",\"sampletext\" I want to query distinct values of sampletext and feed to a Spinner using SimpleCursorAdapter.

3条回答
  •  时光说笑
    2021-01-13 13:00

    android.widget.SimpleCursorAdapter adapter = new android.widget.SimpleCursorAdapter(this,
                android.R.layout.simple_spinner_item,
                cursor,
                new String[] { DBOpenHelper.ACCOUNT_BANK },
                new int[] { android.R.id.text1 }, 0);
    
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    

提交回复
热议问题