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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:22:01+00:00 2026-05-26T09:22:01+00:00

i am new user of android and i had make one android database connection

  • 0

i am new user of android and i had make one android database connection and create table application but at run time it will generate an error.
an error is hear :

 07-15 16:25:55.404: ERROR/AndroidRuntime(3308): Uncaught handler: thread main exiting due to uncaught exception
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308): android.app.SuperNotCalledException: Activity {org.example.sqldemo/org.example.sqldemo.SQLDemo} did not call through to super.onDestroy()
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3134)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):    enter code here at                android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3159)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at android.app.ActivityThread.access$2400(ActivityThread.java:112)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at android.os.Handler.dispatchMessage(Handler.java:99)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at android.os.Looper.loop(Looper.java:123)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at android.app.ActivityThread.main(ActivityThread.java:3948)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at java.lang.reflect.Method.invokeNative(Native Method)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at java.lang.reflect.Method.invoke(Method.java:521)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
 07-15 16:25:55.454: ERROR/AndroidRuntime(3308): at dalvik.system.NativeStart.main(NativeMethod)

SQLDemo.java
my code is hear :

 package com.dailynote;     
 import android.app.Activity;     
 import android.content.ContentValues;     
 import android.database.Cursor;     
 import android.database.sqlite.SQLiteDatabase;     
 import android.os.Bundle;     
 import android.widget.TextView;     
 public class SQLDemo extends Activity {     
   EventDataSQLHelper eventsData;     
   TextView output;     
   @Override     
   public void onCreate(Bundle savedInstanceState) {     
          super.onCreate(savedInstanceState);
     setContentView(R.layout.output);     
     output = (TextView) findViewById(R.id.textView1);     
     eventsData = new EventDataSQLHelper(this);     
     addEvent("Hello Android Event");     
     Cursor cursor = getEvents();     
     showEvents(cursor);     
   }       
   @Override     
   public void onDestroy() {     
     eventsData.close();     
   }     
   private void addEvent(String title) {     
     SQLiteDatabase db = eventsData.getWritableDatabase();     
     ContentValues values = new ContentValues();     
     values.put(EventDataSQLHelper.TIME, System.currentTimeMillis());     
     values.put(EventDataSQLHelper.TITLE, title);
     db.insert(EventDataSQLHelper.TABLE, null, values);
   }
   private Cursor getEvents() {
     SQLiteDatabase db = eventsData.getReadableDatabase();
     Cursor cursor = db.query(EventDataSQLHelper.TABLE, null, null, null, null,
         null, null);    
     startManagingCursor(cursor);
     return cursor;
   }
   private void showEvents(Cursor cursor) {
     StringBuilder ret = new StringBuilder("Saved Events:\n\n");
     while (cursor.moveToNext()) {
       long id = cursor.getLong(0);
       long time = cursor.getLong(1);
       String title = cursor.getString(2);
       ret.append(id + ": " + time + ": " + title + "\n");
     }
     output.setText(ret);
   }
 }

EventDataSQLHelper.java

 package com.dailynote;
 import android.content.Context;
 import android.database.sqlite.SQLiteDatabase;
 import android.database.sqlite.SQLiteOpenHelper;
 import android.provider.BaseColumns;
 import android.util.Log;
 /** Helper to the database, manages versions and creation */
 public class EventDataSQLHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "events.db";
    private static final int DATABASE_VERSION = 1;
    // Table name
    public static final String TABLE = "events";
    // Columns
    public static final String TIME = "time";
    public static final String TITLE = "title";
    public EventDataSQLHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "create table " + TABLE + "( " + BaseColumns._ID
            + " integer primary key autoincrement, " + TIME + " integer, "
                + TITLE + " text not null);";
        Log.d("EventsData", "onCreate: " + sql);
        db.execSQL(sql);
    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (oldVersion >= newVersion)
            return;
        String sql = null;
        if (oldVersion == 1) 
            sql = "alter table " + TABLE + " add note text;";
        if (oldVersion == 2)
            sql = "";
        Log.d("EventsData", "onUpgrade  : " + sql);
        if (sql != null)
            db.execSQL(sql);
    }
 } 
  • 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-26T09:22:02+00:00Added an answer on May 26, 2026 at 9:22 am
    public void onDestroy() {   
        super.onDestroy();
        eventsData.close();     
    }
    

    This is to be called because, Activity class in android does some cleanup by itself.
    When base class functions are overridden by the derived class that is the activity as done in case of onDestroy(), the base class function needs to be called explicitly to perform the expected operation.

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

Sidebar

Related Questions

How can create a New user in ORACLE with full access (alter, delete, select,
In a view I'm trying to create a new user and then log them
So within my application is a form for creating a new user, with relevant
i'm working on a android app that will display Strings to the user, and
I am new to android.I am making an Application where I have to take
I had a fairly simple question regarding activites in an Android application. I'm still
I have a simple Android application that has a TabBar and one of the
I'm new to both android and game development and have been trying to create
I wanted to add a new table in my database, and not change the
I am trying to create a calendar in android which will display the number

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.