This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with SQL  RSS feed

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope its alright to make a new thread but the problem is different.
Alright I have been working on a chess clock of epic proportions and
almost have it up and running. But for the last and coolest part of
its functionality I have hit a wall and would appreciate some help.
The story so far:
The DatabaseHelper class can successfully add rows to the data base
which happens in an activity called add precept. I have pulled the db
file off the device and viewed it with SQLite viewer and all is well.
When I try to load one of the rows and use the data for the main
activities state things begin to go astray.
I have a method in the main activity called setClocks its a wrapper
class that uses the DatabaseHelper method getEntry to fill a MyObject
which has all the data I need to set the apps state. Please help me
figure out why a call of setClocks(1); results in an exception no row
Here is the code:

If I call setClocks(1); in the onCreate of the main activity the app
crashes with the could not find row exception. I know their is a row
with an _id of 1 I can see it on my desktop. I want to load the first
precet when the app loads and then in the onCreateOptionsMenu I have
an option to select a preset. When this is selected it displays a
dialog with a spinner and 2 buttons one for loading the selected
preset and one for removing the selected preset from the database.
Here is my attempt at that. It loads the dialog and the dialog is
populated by the database but when I press load it just goes back to
the main activity with the timers as they where.

And if you need it the setTime method for a ChessClock an inner class
of the main Activity which has its own inner class CountDownTimer

Thank you for reading hope all is well.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!