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

  • Home
  • SEARCH
  • 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 3999828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:42:23+00:00 2026-05-20T07:42:23+00:00

my activity stops unexpectedly as soon as i run the app in the emulator.

  • 0

my activity stops unexpectedly as soon as i run the app in the emulator. What am i doing wrong? Below is my code from the main activity and my android manifest:

package android.Database;


import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class projectsDatabase extends Activity {
    /** Called when the activity is first created. */

    SQLiteDatabase myDB = null;
    final static String MY_DB_NAME ="projectsDatabase";
    final static String MY_DB_TABLE = "projects";

    static final int MENU_PROJECTS = 1;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        onCreateDBAndDBTabled();
        setContentView(R.layout.main);
    }

    private void onCreateDBAndDBTabled(){

        myDB = this.openOrCreateDatabase(MY_DB_NAME, MODE_PRIVATE, null);
        myDB.execSQL("CREATE TABLE IF NOT EXISTS " + MY_DB_TABLE
                + " ( _id integer primary key_autoincrement,"+ 
                "Name varchar(100),"+ 
                "Comment varchar(128),"+ 
                "BookingDetails varchar(255),"+ 
                "Project-Kind integer(3))"
                +"");
         }

    public boolean onCreateOptionsMenu(Menu menu) {
          super.onCreateOptionsMenu(menu);

            menu.add(0, MENU_PROJECTS, 0, R.string.menuProjects)
            .setShortcut('1', 'f')
            .setIcon(R.drawable.icon);
             return true;

          }

    public boolean onOptionsItemSelected(MenuItem item){
          switch (item.getItemId()) {
          case MENU_PROJECTS:
            Intent iProjects= new Intent(this, projects.class);
            startActivity(iProjects);
            return true;
          }
          return false;
        }



}

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".projectsDatabase"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".projects"></activity>
        <activity android:name=".projects_New"></activity>
    </application>
</manifest>

——————————–EDIT——————————————————-

here is my LogCat output:

02-22 08:48:01.999: DEBUG/AndroidRuntime(819): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
02-22 08:48:02.009: DEBUG/AndroidRuntime(819): CheckJNI is ON
02-22 08:48:02.229: DEBUG/AndroidRuntime(819): --- registering native functions ---
02-22 08:48:02.239: INFO/jdwp(819): received file descriptor 23 from ADB
02-22 08:48:02.969: DEBUG/AndroidRuntime(819): Shutting down VM
02-22 08:48:02.979: DEBUG/dalvikvm(819): DestroyJavaVM waiting for non-daemon threads to exit
02-22 08:48:02.979: DEBUG/dalvikvm(819): DestroyJavaVM shutting VM down
02-22 08:48:02.989: DEBUG/dalvikvm(819): HeapWorker thread shutting down
02-22 08:48:02.989: DEBUG/dalvikvm(819): HeapWorker thread has shut down
02-22 08:48:02.999: DEBUG/jdwp(819): JDWP shutting down net...
02-22 08:48:02.999: DEBUG/jdwp(819): +++ peer disconnected
02-22 08:48:02.999: INFO/dalvikvm(819): Debugger has detached; object registry had 1 entries
02-22 08:48:03.009: DEBUG/dalvikvm(819): VM cleaning up
02-22 08:48:03.019: DEBUG/dalvikvm(819): LinearAlloc 0x0 used 629804 of 4194304 (15%)
02-22 08:48:03.479: DEBUG/AndroidRuntime(829): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
02-22 08:48:03.479: DEBUG/AndroidRuntime(829): CheckJNI is ON
02-22 08:48:03.689: DEBUG/AndroidRuntime(829): --- registering native functions ---
02-22 08:48:03.699: INFO/jdwp(829): received file descriptor 23 from ADB
02-22 08:48:04.439: INFO/ActivityManager(559): Starting activity: Intent { action=android.intent.action.MAIN categories={android.intent.category.LAUNCHER} flags=0x10000000 comp={android.Database/android.Database.projectsDatabase} }
02-22 08:48:04.449: DEBUG/AndroidRuntime(829): Shutting down VM
02-22 08:48:04.459: DEBUG/dalvikvm(829): DestroyJavaVM waiting for non-daemon threads to exit
02-22 08:48:04.469: DEBUG/dalvikvm(829): DestroyJavaVM shutting VM down
02-22 08:48:04.469: DEBUG/dalvikvm(829): HeapWorker thread shutting down
02-22 08:48:04.469: DEBUG/dalvikvm(829): HeapWorker thread has shut down
02-22 08:48:04.479: DEBUG/jdwp(829): JDWP shutting down net...
02-22 08:48:04.479: DEBUG/jdwp(829): +++ peer disconnected
02-22 08:48:04.479: INFO/dalvikvm(829): Debugger has detached; object registry had 1 entries
02-22 08:48:04.489: DEBUG/dalvikvm(829): VM cleaning up
02-22 08:48:04.509: DEBUG/dalvikvm(829): LinearAlloc 0x0 used 639228 of 4194304 (15%)

————————————–Edit 2———————————————–
here is my main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
</LinearLayout>
  • 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-20T07:42:24+00:00Added an answer on May 20, 2026 at 7:42 am

    I ran your code, the first LogCat exception gives a good clue:

    02-22 09:08:57.414: ERROR/Database(277): Failure 1 (near "key_autoincrement": syntax error) on 0x121a40 when preparing 'CREATE TABLE IF NOT EXISTS projects ( _id integer primary key_autoincrement,Name varchar(100),Comment varchar(128),BookingDetails varchar(255),Project-Kind integer(3))'.
    

    My database helper is setup like this instead:

        db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
                + " INTEGER PRIMARY KEY AUTOINCREMENT, " + IP_DB
                + " TEXT, " + TIME + " TEXT);");
    

    I think your error lies with the “key_autoincrement” (as the error message implies), try writing it in 2 words as opposed to separating it with an underscore?

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

Sidebar

Related Questions

Hi there im using http://code.google.com/p/aacdecoder-android/ heres my main activity full code: http://pastebin.com/FmaVgfNP but now
When I try to run the code below, my program has stops. I want
So I've got an activity in my android app, that runs on start. This
I am getting an intent delivery error in Logcat, and app stops unexpectedly when
I have implemented an activity that plays media from a URL in Android. In
I have a blank HelloWorld Application: package tutorials.TestReceivers; import android.app.Activity; import android.os.Bundle; public class
I am trying to run to Android code using an AsyncTask . However it
My Activity creates an AsyncTask that loads data from a file and updates the
Main Activity: private Button btnSubmit; private DataSource mDataSource; private Context mContext; @Override public void
I have a Main-Activity which displays several spinners. With a Toggle-Button in the Main-Activity

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.