Android Spinner Selected Item

前端 未结 6 2197
花落未央
花落未央 2020-12-14 13:13

I am populating a spinner from the database like this

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


        
6条回答
  •  心在旅途
    2020-12-14 14:06

    Just get the adapter from your spinner and get the string from the cursor

    Cursor cursor = (Cursor) myAdapter.getItem(position);
    String cityName = cursor.getString(cursor.getColumnIndex(DBAdapter.KEY_NAME));
    

提交回复
热议问题