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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:25:30+00:00 2026-05-29T16:25:30+00:00

I am new to programming and my app crashes every time I try to

  • 0

I am new to programming and my app crashes every time I try to get the data from my extras which are stored in SQL.

public class MainActivity extends ListActivity {
    public final static String ID_EXTRA="com.pixelcrunch._ID";
    Cursor model=null;
    CountdownHelper helper=null;
    CountdownAdapter adapter = null;      
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);      
    helper=new CountdownHelper(this);
    model=helper.getAll();
    startManagingCursor(model);
    adapter=new CountdownAdapter(model);
    setListAdapter(adapter);
    @Override
    public void onListItemClick(ListView list, View view,
                              int position, long id) {
        Intent i=new Intent(MainActivity.this, Edit.class);
        i.putExtra(ID_EXTRA, String.valueOf(id));
        startActivity(i);
    }   

and in my receiving Activity I have

public class Edit extends Activity {
CountdownHelper helper=null;
String countdownId=null;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.edit);
    helper=new CountdownHelper(this);
    countdownId=getIntent().getStringExtra(MainActivity.ID_EXTRA);    
    if (countdownId!=null) {
        load();
    }
}
private void load() {
    Cursor c=helper.getById(countdownId);
    c.moveToFirst();    
    mDescription.setText(helper.getDescription(c));
    mDateDisplay.setText(helper.getDate(c));
    mTimeDisplay.setText(helper.getTime(c));            
    c.close();
}   

and finally my SQL I have

class CountdownHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME="countdown.db";
private static final int SCHEMA_VERSION=1;

public CountdownHelper(Context context) {
    super(context, DATABASE_NAME, null, SCHEMA_VERSION);
}     
@Override
public void onCreate(SQLiteDatabase db) {
    db.execSQL("CREATE TABLE countdowns (_id INTEGER PRIMARY KEY AUTOINCREMENT, description TEXT, date TEXT, time TEXT);");
}

public Cursor getAll() {
    return(getReadableDatabase()
            .rawQuery("SELECT _id, description, date, time FROM countdowns ORDER BY description",
                    null));
      }

public Cursor getById(String id) {
    String[] args={id};     
    return(getReadableDatabase()
            .rawQuery("SELECT _id, description, date, time, FROM countdowns WHERE _ID=?",
                      args));
  }
public void insert(String description, String date, String time) {
    ContentValues cv=new ContentValues();
    cv.put("description", description);
    cv.put("date", date);
    cv.put("time", time);
    getWritableDatabase().insert("countdowns", "description", cv);
}

public void update(String id, String description, String date, String time) {
    ContentValues cv=new ContentValues();
    String[] args={id};
    cv.put("description", description);
    cv.put("date", date);
    cv.put("time", time);
    getWritableDatabase().update("countdowns", cv, "_ID=?",
                      args);
    }

public String getDescription(Cursor c) {
    return(c.getString(1));
}

public String getDate(Cursor c) {
    return(c.getString(2));
}

public String getTime(Cursor c) {
    return(c.getString(3));
}  

Sorry for the long code, I really cant pinpoint where my problem is. I know if I get rid of the code under the load() and replace it with a toast it works. As I am inexperienced and self taught any criticism would be greatly appreciated. Thanks
Logcat:

02-14 19:33:19.798: V/InputMethodManager(23673): focusIn: android.widget.ListView@40eab1e8
02-14 19:33:19.798: V/InputMethodManager(23673): onWindowFocus:    android.widget.ListView@40eab1e8 softInputMode=272 first=true flags=#8010100
02-14 19:33:19.798: V/InputMethodManager(23673): Has been inactive!  Starting fresh
02-14 19:33:19.798: V/InputMethodManager(23673): focusIn: android.widget.ListView@40eab1e8
02-14 19:33:19.798: V/InputMethodManager(23673): checkFocus:  view=android.widget.ListView@40eab1e8 next=android.widget.ListView@40eab1e8 restart=true
02-14 19:33:19.798: V/InputMethodManager(23673): Starting input: view=android.widget.ListView@40eab1e8
02-14 19:33:19.798: V/InputMethodManager(23673): Starting input:   tba=android.view.inputmethod.EditorInfo@423b3230 ic=null
02-14 19:33:19.798: V/InputMethodManager(23673): START INPUT:   android.widget.ListView@40eab1e8 ic=null tba=android.view.inputmethod.EditorInfo@423b3230 initial=true
02-14 19:33:19.803: V/InputMethodManager(23673): Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@423b3dd0  com.android.inputmethod.latin/.LatinIME #1180}
02-14 19:33:25.483: W/ResourceType(23673): No package identifier when getting name for resource number 0x00000000
02-14 19:33:25.488: W/ResourceType(23673): No package identifier when getting name for resource number 0x00000000
02-14 19:33:25.503: W/ResourceType(23673): No package identifier when getting name for resource number 0x00000000
02-14 19:33:25.503: W/ResourceType(23673): No package identifier when getting name for resource number 0x00000000
02-14 19:33:25.533: I/SqliteDatabaseCpp(23673): sqlite returned: error code = 1, msg = near "FROM": syntax error, db=/data/data/com.pixelcrunch.crunchtime/databases/countdown.db
02-14 19:33:25.533: D/AndroidRuntime(23673): Shutting down VM
02-14 19:33:25.533: W/dalvikvm(23673): threadid=1: thread exiting with uncaught exception (group=0x40c381f8)
02-14 19:33:25.538: E/AndroidRuntime(23673): FATAL EXCEPTION: main
02-14 19:33:25.538: E/AndroidRuntime(23673): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pixelcrunch.crunchtime/com.pixelcrunch.crunchtime.Edit}: android.database.sqlite.SQLiteException: near "FROM": syntax error: , while compiling: SELECT _id, description, date, time, FROM countdowns WHERE _ID=?
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1968)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.os.Looper.loop(Looper.java:137)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.app.ActivityThread.main(ActivityThread.java:4507)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at java.lang.reflect.Method.invokeNative(Native Method)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at java.lang.reflect.Method.invoke(Method.java:511)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at dalvik.system.NativeStart.main(Native Method)
02-14 19:33:25.538: E/AndroidRuntime(23673): Caused by: android.database.sqlite.SQLiteException: near "FROM": syntax error: , while compiling: SELECT _id, description, date, time, FROM countdowns WHERE _ID=?
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:127)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1673)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1647)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at com.pixelcrunch.crunchtime.CountdownHelper.getById(CountdownHelper.java:33)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at com.pixelcrunch.crunchtime.Edit.load(Edit.java:78)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at com.pixelcrunch.crunchtime.Edit.onCreate(Edit.java:68)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.app.Activity.performCreate(Activity.java:4465)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
02-14 19:33:25.538: E/AndroidRuntime(23673):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
02-14 19:33:25.538: E/AndroidRuntime(23673):    ... 11 more

if failed at the first:

02-14 19:33:25.483: W/ResourceType(23673): No package identifier when getting name for resource number 0x00000000
  • 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-29T16:25:30+00:00Added an answer on May 29, 2026 at 4:25 pm

    As it looks from the exception

    02-14 19:33:25.538: E/AndroidRuntime(23673): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pixelcrunch.crunchtime/com.pixelcrunch.crunchtime.Edit}: android.database.sqlite.SQLiteException: near "FROM": syntax error: , while compiling: SELECT _id, description, date, time, FROM countdowns WHERE _ID=?
    

    the line

      .rawQuery("SELECT _id, description, date, time, FROM countdowns WHERE _ID=?",
    

    Should be

      .rawQuery("SELECT _id, description, date, time FROM countdowns WHERE _ID=?",
      //                                            ^removed comma
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Blackberry programming and starting my first app soon. I believe
I'm abit new to programming Android App's, however I have come across a problem,
im new to iPhone programming..in my app the timer is not working fine. can
I am new to database programming with Google App Engine and am programming in
First off I'm new at programming. I'm creating an app with one navigation bar
Im super new to programming and trying to get to grips with rails, I'm
I am new to web programming, coming from a video game development background (c++),
I have hierarchical data stored in the datastore using a model which looks like
I'm new to Windows Phone 7 App Programming, so I hope this question isn't
I am quite new to programming, but now experimenting with a table view app.

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.