The solution I found is to change deleteallnotes() to: public void
deleteAllNotes() { mDb.execSQL("DROP TABLE IF EXISTS
notes");mDb.execSQL(DATABASE_CREATE); }

On Dec 30, 8:44 am, Jeresam515 <[email protected]> wrote:
> So I'm trying to have a menu button to clear my database when it is
> pressed, that works fine. However, as soon as new information is sent
> to the database the app force closes. How should i stop this? Here is
> the clear part:
>
> @Override public boolean onMenuItemSelected(int featureId, MenuItem
> item) { switch(item.getItemId()) { case INSERT_ID: //reset just makes
> all the variables in the thred reinitialize at base values
> mLemonadeMainMenuView.reset(); NotesMade = 0;
> mDbHelper.deleteAllNotes(); return true; }
>
> Here is deleteallnotes(): public boolean deleteAllNotes() { return
> mDb.delete(DATABASE_TABLE,"1", null) > 0; }
>
> Here is the new data information:
>
> @Override public boolean onTouchEvent(MotionEvent event)
> { mDbHelper.createNote(event.getX(), event.getY(), 1); NotesMade ++;
> mLemonadeMainMenuView.setCoords(NotesMade); return true; }
>
> Finally, here is the recieving end:
>
> while(mNotesMade>mNoteId) {mNoteId++; Cursor note =
> mDbHelper.fetchNote(mNoteId); Float x; Float y; Float size; x =
> Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDb
> Adapter.KEY_X))); y=
> Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesDb
> Adapter.KEY_Y))); size
> =Float.valueOf(note.getString(note.getColumnIndexOrThrow(NotesD
> bAdapter.KEY_X))); canvas.drawCircle(x, y, 1, paint);} }
>
> note: I have already tried starting and stopping the thred in addition
> to the above

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to