get Database from Context - Android Database

Android examples for Database:Database File

Description

get Database from Context

Demo Code


//package com.book2s;
import android.content.Context;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    public static SQLiteDatabase getDatabase(Context context) {
        return context.openOrCreateDatabase("tomato.db",
                Context.MODE_PRIVATE, null);
    }//  w  ww. j  a  v  a  2s .  co  m
}

Related Tutorials