Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8118687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:34:07+00:00 2026-06-06T04:34:07+00:00

I created one app for database which contains a student table and 3 fields

  • 0

I created one app for database which contains a student table and 3 fields in it, but I don’t know how to add the file in the app to the sqlite database.

database helper:

  public class DatabaseHelper extends SQLiteOpenHelper {

  public static final String DATA_BASE="Mydatabase.db";
public static final String TABLE_NAME="Student";
public static final int DATABASE_VERSION =1;

public DatabaseHelper(Context context) {
 super(context, DATA_BASE, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {

db.execSQL("CREATE TABLE " + TABLE_NAME + 
 "(Name TEXT, AGE NUMERIC, ADDRESS TEXT)"); }

@Override
public void onUpgrade(SQLiteDatabase db,
        int oldVersion, int newVersion) {

}
}

main activity:

public class DatabaseHelper extends SQLiteOpenHelper {

public static final String DATA_BASE="Mydatabase.db";
public static final String TABLE_NAME="Student";
public static final int DATABASE_VERSION =1;

public DatabaseHelper(Context context) {
 super(context, DATA_BASE, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {

db.execSQL("CREATE TABLE " + TABLE_NAME + 
 "(Name TEXT, AGE NUMERIC, ADDRESS TEXT)"); }

@Override
public void onUpgrade(SQLiteDatabase db,
        int oldVersion, int newVersion) {

}
}

display activity:

  public class DisplayActivity extends Activity {

private ArrayList<String> arrayList = 
                    new ArrayList<String>();

private SQLiteDatabase Mydatabase;
ListView listView;
EditText enter;
@Override
public void onCreate(Bundle b) {
    super.onCreate(b);
    setContentView(R.layout.display);
    listView=(ListView)findViewById(R.id.listView);

    //OpenAndQueryDatabase

    try {
    DatabaseHelper db = new DatabaseHelper(this);
        //Open the database
        Mydatabase = db.getWritableDatabase();
        Cursor c = Mydatabase.rawQuery(
                "SELECT * FROM Student", null);

        if (c != null ) {
            if  (c.moveToFirst()) {
                do {
                    String Name = c.getString(
                            c.getColumnIndex("Name"));
                    int age = c.getInt(
                            c.getColumnIndex("AGE"));
                    String address = c.getString(
                            c.getColumnIndex("ADDRESS"));
                arrayList.add("Name    : " + Name +"\n"+ 
                               "Age        : " +age +"\n"+
                               "Address : " + address+"\n");
                }while (c.moveToNext());
            } 
        }           
        } catch (SQLiteException se ) { } 
        finally {
        if (Mydatabase != null) 
            Mydatabase.close();
    }


    //displayResultList

  listView.setAdapter(new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, 
                                    arrayList));
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:34:10+00:00Added an answer on June 6, 2026 at 4:34 am

    You can find your answer here. Just create a file inside a place in SD Card.

    data/ folder is protected by the OS, just rooted devices can see it.

    What you need is inside the answer of the link: open the file inside your SDCARD with new File(“/sdcard/myFolder/myFile.sqlite”).

    File databaseLocation = new File("/sdcard/myFolder/myFile.sqlite" ); 
    SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(databaseLocation , null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing an app related to SQLite. In that app I created one
I've created an online store within an android app in webview but have one
I have created the application which is based on Sqlite database. So in my
I am building an app which contains a form in one view,in which the
in my app in the first activity i have created a database which stores
I have created one database and one table user in that while running my
I am using the Visual Studio 2005, and i created one application with App.config
In my app i have created one custom class for Label.Now i want to
I am working with sencha to build mobile app. I have created one page
In one of my builds for an iPhone app, I had inadvertently created a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.