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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:40:52+00:00 2026-06-07T00:40:52+00:00

Actually I am developing one application in that when application run first time it

  • 0

Actually I am developing one application in that when application run
first time it will create one txt file and if file is already exists then it will simply write that on file.
But I don’t know how to check programatically that
file is exist or not.I have tried,

try  
    {  
        FPartyCreation = new File ("/data/data/com.MediExcel/files/","dbPartyCreation.dat");  
        if (FPartyCreation.exists())  
        {  
            writeOnFile();
        }  
        else  
        {  
            FPartyCreation.createNewFile();  
            writeOnFile();
        }  
    }  
    catch (IOException ioe)  
    {  
        ioe.printStackTrace();  
    }  

But it gives following errors , and also file is not created on same path.

07-06 01:39:26.183: E/AndroidRuntime(23107): FATAL EXCEPTION: main
07-06 01:39:26.183: E/AndroidRuntime(23107): java.lang.NullPointerException
07-06 01:39:26.183: E/AndroidRuntime(23107):    at com.MediExcel.AddMethodPartyCreation.getMethod(AddMethodPartyCreation.java:28)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at com.MediExcel.PartyCreationActivity$1.onClick(PartyCreationActivity.java:64)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at android.view.View.performClick(View.java:3511)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at android.view.View$PerformClick.run(View.java:14105)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at android.os.Handler.handleCallback(Handler.java:605)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at android.os.Handler.dispatchMessage(Handler.java:92)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at android.os.Looper.loop(Looper.java:137)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at android.app.ActivityThread.main(ActivityThread.java:4424)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at java.lang.reflect.Method.invokeNative(Native Method)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at java.lang.reflect.Method.invoke(Method.java:511)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-06 01:39:26.183: E/AndroidRuntime(23107):    at dalvik.system.NativeStart.main(Native Method)

Please help me

Thanks

  • 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-07T00:40:54+00:00Added an answer on June 7, 2026 at 12:40 am

    Creating SQLite Database –

    public class DatabaseHelper extends SQLiteOpenHelper {
    
    static final String dbName="demoDB";
    static final String employeeTable="Employees";
    static final String colID="EmployeeID";
    static final String colName="EmployeeName";
    static final String colAge="Age";
    static final String colDept="Dept";
    
    static final String deptTable="Dept";
    static final String colDeptID="DeptID";
    static final String colDeptName="DeptName";
    
    static final String viewEmps="ViewEmps";
    

    Creating the Database

    public void onCreate(SQLiteDatabase db) 
    {
        // TODO Auto-generated method stub
    
        db.execSQL("CREATE TABLE "+deptTable+" ("+colDeptID+ " INTEGER PRIMARY KEY , "+
        colDeptName+ " TEXT)");
    
      db.execSQL("CREATE TABLE "+employeeTable+" 
        ("+colID+" INTEGER PRIMARY KEY AUTOINCREMENT, "+
            colName+" TEXT, "+colAge+" Integer, "+colDept+" 
        INTEGER NOT NULL ,FOREIGN KEY ("+colDept+") REFERENCES 
        "+deptTable+" ("+colDeptID+"));");
    
    
      db.execSQL("CREATE TRIGGER fk_empdept_deptid " +
        " BEFORE INSERT "+
        " ON "+employeeTable+
    
        " FOR EACH ROW BEGIN"+
        " SELECT CASE WHEN ((SELECT "+colDeptID+" FROM "+deptTable+" 
        WHERE "+colDeptID+"=new."+colDept+" ) IS NULL)"+
        " THEN RAISE (ABORT,'Foreign Key Violation') END;"+
        "  END;");
    
      db.execSQL("CREATE VIEW "+viewEmps+
        " AS SELECT "+employeeTable+"."+colID+" AS _id,"+
        " "+employeeTable+"."+colName+","+
        " "+employeeTable+"."+colAge+","+
        " "+deptTable+"."+colDeptName+""+
        " FROM "+employeeTable+" JOIN "+deptTable+
        " ON "+employeeTable+"."+colDept+" ="+deptTable+"."+colDeptID
        );
      //Inserts pre-defined departments
      InsertDepts(db);  
     }
    

    Have a look at this Using-SQLite-Database-with-Android blog. Hope this blog is enough for your queries.

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

Sidebar

Related Questions

I'm actually developing an application using Google Drive SDK. I don't want to create
I'm developing an application that will need to communicate with itself running on different
I'm developing an iPhone iOS4 application and one of the things that it have
Im developing one GUI in C#.Net under WPF.Actually its an application for serial communication
I'm developing a JSF web application, with the current 2.1.7 JSF version . Actually,
I am developing a Java web application that bases it behavior through large XML
At work, we are developing an PHP application that would be later re-programmed into
I'm developing an application which will have these classes: class Shortcut { public string
have a really annoying time developing some code for a set of UserControls that
I am developing an application that shows all the courses that take place in

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.