Android Developer
- Forum posts: 2
Jul 24, 2012, 1:59:45 PM via Website
Jul 24, 2012 1:59:45 PM via Website
Hi,
i was getting some error while connecting the data base
Here is my code (maindb.java)
package com.example.db1;
import android.app.Activity;
import android.os.Bundle;
import android.database.sqlite.SQLiteDatabase;
public class maindb extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maindb);
SQLiteDatabase db;
db = openOrCreateDatabase("DataBase.db",
SQLiteDatabase.CREATE_IF_NECESSARY, null);
//do the task you want here
db.close();
}
}
do i need to do anything else. It would be great help for me if some one helps on this
Thanks in Advance
i was getting some error while connecting the data base
Here is my code (maindb.java)
package com.example.db1;
import android.app.Activity;
import android.os.Bundle;
import android.database.sqlite.SQLiteDatabase;
public class maindb extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maindb);
SQLiteDatabase db;
db = openOrCreateDatabase("DataBase.db",
SQLiteDatabase.CREATE_IF_NECESSARY, null);
//do the task you want here
db.close();
}
}
do i need to do anything else. It would be great help for me if some one helps on this
Thanks in Advance
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.