0
我目前正在編寫一個應用程序,允許您選擇一個類別,應用程序將檢索該類別中的所有結果並將其打印到屏幕上。創建數據庫的代碼很好,但我不確定我的檢索方法是否正確,然後完全不確定如何將結果的單個名稱打印到TextView中。打印選定的數據庫值
目前,我有:
public Cursor getDatabase(int category)
{
String myPath = DB_PATH + DB_NAME;
myData = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
Cursor cur;
cur=myData.rawQuery("select * from youthcentres where cat1='"+category+"' OR cat2 ='"+category+"' OR cat3='"+category+"'",null);
cur.moveToFirst();
myData.close();
return cur;
};
非常感謝您,這非常有幫助! – CuriousCabbage