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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:00:37+00:00 2026-06-03T08:00:37+00:00

I am working to create a db file in my application. Now I want

  • 0

I am working to create a db file in my application. Now I want to create the .db file on application installation just one time.
When I open the app, it just check for the existence of the file.

How can we check for a .db file in sdcard and if it exists before installation than to delete the file.

  • 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-03T08:00:38+00:00Added an answer on June 3, 2026 at 8:00 am

    You can check if file exists or not using following code

     FileConnection fileConnection = (FileConnection)Connector.open("file:///SDCard/foldername/" + "databasename.db");
    
        boolean result=fileConnection.exists(); 
    
      if(result)
      {
         //database available
      }else{
           //database not available
      }
    

    and next you want to check this when application first time instalation using

     CodeModuleListener listner=new CodeModuleListener() {
    
                public void modulesDeleted(String[] moduleNames) {
                    // TODO Auto-generated method stub
    
                }
    
                public void modulesAdded(int[] handles) {
                    // TODO Auto-generated method stub
                    //here you can check if database available or not if available then delete 
                    try{
                        URI myURI = URI.create("file:///SDCard/foldername/" + "database_name.db"); 
                        DatabaseFactory.delete(myURI);  
                    }catch (Exception e) {
                        // TODO: handle exception
                    }
    
                }
    
                public void moduleDeletionsPending(String[] moduleNames) {
                    // TODO Auto-generated method stub
    
                }
            };
            CodeModuleManager.addListener(this.getApplication(), listner);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create and then open a txt file using the ShellExecute command.
I want to use Qt to create a simple GUI application that can play
I've been struggling with this for some time now and I just can't find
write now, I am working on an app that is based on an application
I want to write an tail like app. Now this app, scans a file
I create excel file with chart and it's working on my local machine with
I did heroku create and pushed a working rails app to the server. Everything
I am trying to create a help panel for an application I am working
I copied jquery.js to WebContent/js/jquery/jquery.js . Now I want to use that file in
I created a setup file which is working awesome. Now whenever I rebuild an

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.