Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private SQLiteDatabase mediadb;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.mainmenu);
- mediadb = openOrCreateDatabase("prayerpartners",SQLiteDatabase.CREATE_IF_NECESSARY, null);
- mediadb.setLocale(Locale.getDefault()); // Set the locale
- mediadb.setLockingEnabled(true);
- mediadb.setVersion(1);
- final String[] cols = {"label","who","desc","filename","catagory"};
- mediadb.execSQL(FormHelper.starttable("prayermedia", cols, true));
- getdata();
- }
- private void getdata()
- {
- Integer pickedid = thesettings.getInt("picked", -1);
- if(pickedid!=-1)
- {
- Cursor c = mediadb.query("prayermedia", null, "id=?", new String[]{String.valueOf(pickedid)}, null, null,null);
- startManagingCursor(c);
- int test=c.getCount();
- if(test>0)
- {
- c.moveToFirst();
- medianame=c.getString(c.getColumnIndex("filename"));
- }
- c.close();
- }
- }
- //when paused
- @Override
- public void onPause() {
- if(mediadb!=null){mediadb.close();}
- super.onPause();
- }
- // Close table when leaving the page.
- @Override
- protected void onDestroy()
- {
- if(mediadb!=null){mediadb.close();}
- super.onDestroy();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement