Code example for SQLiteDatabase

Methods: execSQL, close

0
	private void create(){ 
		SQLiteDatabase db = mActivity.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null);
 
		// create tables if necessary 
		 
		db.execSQL("CREATE TABLE IF NOT EXISTS "
				+ TABLE_PLAYLIST
				+ " (PlaylistName VARCHAR UNIQUE," 
				+ " FileName INTEGER PRIMARY KEY AUTOINCREMENT);"); 
		 
		db.execSQL("CREATE TABLE IF NOT EXISTS "
				+ TABLE_RECENT_RADIOS
				+ " (radio_id INTEGER UNIQUE, radio_idstr VARCHAR, radio_name VARCHAR, radio_image VARCHAR, radio_date INTEGER);"); 
		 
		db.execSQL("CREATE TABLE IF NOT EXISTS "
				+ TABLE_FAVORITES
				+ " (track_id INTEGER UNIQUE, track_name VARCHAR,"  
				+ " track_duration INTEGER, track_url VARCHAR, track_stream VARCHAR, track_rating REAL,"  
				+ " album_id INTEGER, album_name VARCHAR, album_image VARCHAR, album_rating REAL, artist_name VARCHAR);"); 
 
		db.close();
	} 
 
	@Override 
	public void deletePlaylist(String playlistName) {
		SQLiteDatabase db = mActivity.openOrCreateDatabase(DB_NAME, Context.MODE_PRIVATE, null);