Created
September 13, 2010 20:01
-
-
Save marshall/577919 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 void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
TextView label = (TextView)findViewById(R.id.TextView01); | |
String dbPath = "/sdcard/test.db"; | |
SQLiteOpenHelper helper = new SQLiteOpenHelper(this, dbPath, null, 1) { | |
@Override | |
public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) { | |
// TODO Auto-generated method stub | |
} | |
@Override | |
public void onCreate(SQLiteDatabase arg0) { | |
// TODO Auto-generated method stub | |
} | |
}; | |
SQLiteDatabase db = helper.getReadableDatabase(); | |
Cursor c = db.rawQuery("SELECT message FROM test", null); | |
c.moveToNext(); | |
String message = c.getString(c.getColumnIndex("message")); | |
c.close(); | |
db.close(); | |
label.setText(message); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment