Note that there are some explanatory texts on larger screens.

plurals
  1. POSQLiteOpenHelper constructor problem
    primarykey
    data
    text
    <p>I Created SQLite Database in SQLiteBrowser. I want to refer it in android app so I put DB file in assets folder n used the following code to copy DB to App memory. M using eclipse for android app development.</p> <p>But SQLiteOpenHelper constructor is giving error. The constructor DB_Import(DB_test1) is undefined</p> <pre><code>package com.example.DB_test1; public class DB_test1 extends Activity{ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); DB_Import my_Import; //SQLiteDatabase myDb = null; my_Import=new DB_Import(this); try { my_Import.createDatabase(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre> <p>Following is another class file.</p> <pre><code>package com.example.DB_test1; public class DB_Import extends SQLiteOpenHelper{ private final Context myContext; String DB_PATH = "data/data/com.example.DB_test/databases/"; String DB_NAME = "Dict_temp"; private SQLiteDatabase myDatabase; public DB_Import(Context context) { super(context, "data/data/com.example.DB_test/databases/", null, 1); this.myContext = context; } public void createDatabase()throws IOException{ // TODO Auto-generated method stub boolean dbExist = checkDatabase(); ////////////////Check if database Exist if (dbExist) { //openDatabase(); }else { this.getReadableDatabase(); try { copyDatabase(); ///////////////Copies the database from assets to android } catch (IOException e) { // TODO Auto-generated catch block throw new Error("Error copying database"); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload