Created
March 1, 2014 19:25
-
-
Save msdalp/9295644 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public synchronized String getDataValue(long _id) { | |
final SQLiteDatabase db = this.getReadableDatabase(); | |
String retval = null; | |
try { | |
Cursor cursor = db.query("data", new String[]{"VALUE"}, | |
"ID = ?", new String[]{String.valueOf(_id)}, null, null, null); | |
if (cursor != null) { | |
if (cursor.moveToFirst()) { | |
do { | |
retval = cursor.getString(0); | |
} while (cursor.moveToNext()); | |
} | |
} | |
} catch (Exception ex) { | |
retval = null; | |
Log.e(TAG, "Cannot get data value:", ex); | |
} finally { | |
db.close(); | |
} | |
return retval; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment