I have a table created from SQLiteStudio that when copied to the assets
folder in an Eclipse application does not work.
In case my bank class will only have one method list (which is what I need) because the bank is already created with the table and the data.
public class DatabaseHandler extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "rtw";
public DatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public List<String> getAllLabels(){
List<String> list = new ArrayList<String>();
// Select All Query
String selectQuery = "SELECT * FROM regiao where uf = 'RS' " ;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);//selectQuery,selectedArguments
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
list.add(cursor.getString(1));//adding 2nd column data
} while (cursor.moveToNext());
}
// closing connection
cursor.close();
db.close();
// returning lables
return list;
}
How to solve the problem?