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 8031215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:01:08+00:00 2026-06-05T01:01:08+00:00

public class DBOpener { private static String DB_PATH = /data/data/com.edu.tp.iit.mns/databases/; // path // of

  • 0
public class DBOpener {

private static String DB_PATH = "/data/data/com.edu.tp.iit.mns/databases/"; // path
                                                                            // of
                                                                            // our
                                                                            // database
private static String DB_NAME = "finals"; // Database name
private final Context myContext;
private SQLiteDatabase db;

public DBOpener(Context context) {
    myContext = context;
}

public void open() {
    boolean dbExists = checkDatabase();
    if (!dbExists) {
        try {
            copyDatabase();
        } catch (IOException e) {
            throw new RuntimeException("Something bad!!!");
        }
    }
    String path = DB_PATH + DB_NAME;
    db = SQLiteDatabase.openDatabase(path, null,
            SQLiteDatabase.OPEN_READWRITE);
}

private boolean checkDatabase() {
    SQLiteDatabase checkDB = null;
    try {
        // Try opening the database
        String path = DB_PATH + DB_NAME;
        checkDB = SQLiteDatabase.openDatabase(path, null,
                SQLiteDatabase.OPEN_READONLY);
    } catch (SQLiteException e) {
        throw new RuntimeException("Something bad111111!!!");
    }
    if (checkDB != null)
        checkDB.close(); // Close the DB; we don’t need it now
    return checkDB != null;
}

my error log file:

  06-04 14:00:38.756: E/Database(306): sqlite3_open_v2("/data/data/com.edu.tp.iit.mns/databases/finals", &handle, 1, NULL) failed
  06-04 14:00:38.836: E/AndroidRuntime(306): FATAL EXCEPTION: main
  06-04 14:00:38.836: E/AndroidRuntime(306): java.lang.RuntimeException: Unable to resume activity {com.edu.tp.iit.mns/com.edu.tp.iit.mns.Lunch}: java.lang.RuntimeException: Something bad111111!!!
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3128)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2684)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.os.Handler.dispatchMessage(Handler.java:99)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.os.Looper.loop(Looper.java:123)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.ActivityThread.main(ActivityThread.java:4627)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at java.lang.reflect.Method.invokeNative(Native Method)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at java.lang.reflect.Method.invoke(Method.java:521)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at dalvik.system.NativeStart.main(Native Method)
  06-04 14:00:38.836: E/AndroidRuntime(306): Caused by: java.lang.RuntimeException: Something bad111111!!!
  06-04 14:00:38.836: E/AndroidRuntime(306):    at com.edu.tp.iit.mns.DBOpener.checkDatabase(DBOpener.java:50)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at com.edu.tp.iit.mns.DBOpener.open(DBOpener.java:29)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at com.edu.tp.iit.mns.Lunch.onResume(Lunch.java:49)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.Activity.performResume(Activity.java:3823)
  06-04 14:00:38.836: E/AndroidRuntime(306):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
  06-04 14:00:38.836: E/AndroidRuntime(306):    ... 12 more

my program was running fine till i deleted the database from the assets folder and data/data/ databases folder and put back my new database file. i cannot continue my code because of this error. any help?

  • 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-05T01:01:10+00:00Added an answer on June 5, 2026 at 1:01 am

    Modify the method checkDatabase() like this:

    private boolean checkDatabase() {
        File dbFile = new File(DB_PATH + DB_NAME);
        return dbFile.exists();
    }
    

    See this link for reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class BobDatabase extends SQLiteOpenHelper{ private static final String DATABASE_NAME = bob.db; private static
public class Bird { private static int id = 0; private String kind; public
public class PackageTabActivity extends ListActivity{ HashMap<String,Object> hm ; ArrayList<HashMap<String,Object>> applistwithicon ; private static final
public class Bird { private static int id = 0; private String kind; public
public class TestBL { public static void AddFolder(string folderName) { using (var ts =
public class Order { static Customer cust = new Customer(); string sEmpty = ;
public class Employee { public static void main(String[] args) { int j=3; staples[] stemp
public class InterruptedInput { public static void main(String[] args) { InputThread th=new InputThread(); //worker
public class Base{ protected String str; public static final Base ERROR = new Base(error);
public class Demo { public static void main(String args[]) { double d = 12.345;

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.