相关疑难解决方法(0)

Android Spinner选择的项目

我像这样从数据库中填充一个微调器

    // Populating the City Spinner
    Cursor cities = db.cityList();
    startManagingCursor(cities);

    // create an array to specify which fields we want to display
    String[] from = new String[] { DBAdapter.KEY_NAME };
    // create an array of the display item we want to bind our data to
    int[] to = new int[] { android.R.id.text1 };

    Spinner cityList = (Spinner) this.findViewById(R.id.citySpiner);
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, cities, from, to);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    cityList.setAdapter(adapter);
Run Code Online (Sandbox Code Playgroud)

当我尝试从这个微调器的选定项目中获取内容时

// Get the City
                Spinner getCity = (Spinner) findViewById(R.id.citySpiner); …
Run Code Online (Sandbox Code Playgroud)

database android cursor spinner

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

android ×1

cursor ×1

database ×1

spinner ×1