这里我只得到单个值并将其保存在spinner
但我想在一个微调器中检索两个列值
public List<String> getAllLabels1(){
List<String> labels = new ArrayList<String>();
// Select All Query
String selectQuery = "SELECT DISTINCT WeatherPrediction.CropID as CropID, Crop.Name as Name FROM Crop INNER JOIN " +
"WeatherPrediction ON Crop.CropID = WeatherPrediction.CropID order by Name";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
labels.add(cursor.getString(0));
} while (cursor.moveToNext());
}
// closing connection
cursor.close();
db.close();
// returning lables
return labels;
}