Skip to content

Instantly share code, notes, and snippets.

@MarcTowler
Created January 13, 2017 00:09
Show Gist options
  • Save MarcTowler/b9f47db717e0e23d26860163a1c9881c to your computer and use it in GitHub Desktop.
Save MarcTowler/b9f47db717e0e23d26860163a1c9881c to your computer and use it in GitHub Desktop.
//First file - has all the database bits in and extends SQLiteOpenHelper
public Cursor queryOne(String name) {
SQLiteDatabase db = this.getWritableDatabase();
Cursor res = db.rawQuery("SELECT type1, type2 FROM Pokemon WHERE name = ?",
new String[]{name});
return res;
}
//second file - this pulls the data
protected void typeResults(String[] name) {
int size = name.length;
String[] types;
Cursor res = myDB.queryOne(pokemon[0]);
if(res != null && res.moveToFirst()) {
//all it seems to pull here is I/System.out: android.database.sqlite.SQLiteCursor@6d701d7
System.out.println(res.toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment