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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:03:47+00:00 2026-05-25T12:03:47+00:00

i am new to android. In my application i used four classes. loading page,menu

  • 0

i am new to android.
In my application i used four classes. loading page,menu class,alarm set class,and database class.When i click on a button in loading page it goes to menu class and in menu class i click on alarm set option ,it goes to alarm set class.After set the alarm, it save the data in database.And i want to show that data in menu class as list view,so i again open data base in menu class and get the data using cursor ,and displayed in list view,

But my problem is when the user start the application very first time ,he is click on a button in loading page ,he have to go to menu class,but error will occur in that time.Because in menu class i open the database but table is not there.i creating the table in alarm set class.So without having table it can’t handle the cursor.
so i want to know is table is exit or not after creating the database.
my code is for creating the database is

alarmDB = this.openOrCreateDatabase(CRAZY_ALARM_DB_NAME, MODE_PRIVATE, null);
  • 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-05-25T12:03:48+00:00Added an answer on May 25, 2026 at 12:03 pm

    An alternative would be to use try/catch. This will stop from error/crashing and you can set options when an exception occurs.

            try
            {
                alarmDB = this.openOrCreateDatabase(CRAZY_ALARM_DB_NAME, MODE_PRIVATE, null);
            }
            catch(Exception e)
            {
                Log.v("Hello","Exception trying to open database:" + e.toString());
            }
    

    And for tables it would be the same. Like:

    final String CREATE_TABLE_USER =
            "CREATE TABLE tbl_user (" 
            + "id INTEGER,"
            + "name TEXT,"
            + "email TEXT,"
            + "password TEXT,"
            + "terms TEXT);";
    
    try
    {
        db.execSQL(CREATE_TABLE_USER);
    }
    catch (Exception e)
    {
        Log.v("Hello","Exception trying to create table:" + e.toString());
    }
    

    If you want a list of all tables then you can check a similar question here: Retrieve a list of all tables in the database

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

Sidebar

Related Questions

The new Android 2.1 SDK (version 7) has a new class called SignalStrength: http://developer.android.com/reference/android/telephony/SignalStrength.html
My android application used to be able to connect to the Facebook server via
I'm new to Android application development and I'm currently experimenting with various UI ideas.
Hai i developed a application in android,in my application i used a dynamically created
I created a sample audio player application in android. In my application I used
I used this code in my Android application: import org.apache.http.client.methods.HttpPost; ... HttpClient httpclient =
I've made an Android application which contains most used German words and sentences. The
I have used tabbar with activity group in my application. I have four tab
In my android application i have used the google map. I have using android
I am new to Android development. I am working on application where Sql-lite is

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.