[android-developers] Database access error causes force close

2014-12-05 Thread Jim Graham
I'm trying to use an SQLite table with Android (and for almost the first
time, period, but I familiarized myself with it using SQLite3 /
tclsh8.4), and I've run into a bit of a problem where I can't seem to
spot the error.

Here is the code where it's failing and force closing:

   ---  CUT HERE  ---

   // global - before start of DataBaseHelper class:
   private static final String TABLE_GRAINBRANDS = grainbrands;

   // much later in DataBaseHelper
   
   ListString grainBrandsList = new ArrayListString();
   String selectQuery = SELECT  * FROM  + TABLE_GRAINBRANDS;
   String brand;

   SQLiteDatabase db = this.getWritableDatabase();
   Cursor c = db.rawQuery(selectQuery, null); // This is the line (75)
   // that logcat says causes the force close


   ---  CUT HERE  ---

Surrounding logcat code:

---  CUT HERE  ---

I/ActivityManager(15152): Start proc com.jdgapps.andgtbrew2 for activity
  com.jdgapps.andgtbrew2/.AndGTbrew2: pid=28296 uid=10327
  gids={1015, 1028}

I/ActivityManager(15152): Displayed com.jdgapps.andgtbrew2/.AndGTbrew2: +3s183ms

E/AndroidRuntime(28296):
   at 
com.jdgapps.andgtbrew2.DataBaseHelper.getGrainBrands(DataBaseHelper.java:175)

E/AndroidRuntime(28296):  at 
com.jdgapps.andgtbrew2.AndGTbrew2$1.onClick(AndGTbrew2.java:92)

W/ActivityManager(15152):   Force finishing activity 
com.jdgapps.andgtbrew2/.AndGTbrew2

W/ActivityManager(15152): Activity pause timeout for
   ActivityRecord{4280e468 com.jdgapps.andgtbrew2/.AndGTbrew2}

I/ActivityManager(15152): Process com.jdgapps.andgtbrew2 (pid 28296) has died.

---  CUT HERE  ---

Unfortunately, this error message doesn't tell me much, and while looking
between tutorials and my code here, I can't see what's wrong with it.

I tried to check in /data/data/com.jdgapps.andgtbrew2/ to see if gtbrew2.db
was there, but /data was empty, so I gather it's hidden.  Good security,
normally, but a PITA right now.

Logcat does not show any of the errors that would be generated if the
dabase copy (from assets to the above) failed, so it should be there.

Does anyone see anything that I might have missed?

Thanks,
   --jim

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)  | 
spooky1...@gmail.com  | TeX actually recognizes several kinds of
 Running Mac OS X Lion  | infinity, some of which are ``more infinite''
ICBM / Hurricane: | than others.
   30.44406N 86.  59909W  |   --Donald Knuth in {The TeXbook}

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Database access error causes force close

2014-12-05 Thread Steve Gabrilowitz
You could try putting a try/catch block around the offending statement to
catch a generic exception, maybe finding out exactly what exception pops up
might give you a clue?
On Dec 5, 2014 4:00 PM, Jim Graham spooky1...@gmail.com wrote:

 I'm trying to use an SQLite table with Android (and for almost the first
 time, period, but I familiarized myself with it using SQLite3 /
 tclsh8.4), and I've run into a bit of a problem where I can't seem to
 spot the error.

 Here is the code where it's failing and force closing:

---  CUT HERE  ---

// global - before start of DataBaseHelper class:
private static final String TABLE_GRAINBRANDS = grainbrands;

// much later in DataBaseHelper

ListString grainBrandsList = new ArrayListString();
String selectQuery = SELECT  * FROM  + TABLE_GRAINBRANDS;
String brand;

SQLiteDatabase db = this.getWritableDatabase();
Cursor c = db.rawQuery(selectQuery, null); // This is the line (75)
// that logcat says causes the force close


---  CUT HERE  ---

 Surrounding logcat code:

 ---  CUT HERE  ---

 I/ActivityManager(15152): Start proc com.jdgapps.andgtbrew2 for activity
   com.jdgapps.andgtbrew2/.AndGTbrew2: pid=28296 uid=10327
   gids={1015, 1028}

 I/ActivityManager(15152): Displayed com.jdgapps.andgtbrew2/.AndGTbrew2:
 +3s183ms

 E/AndroidRuntime(28296):
at
 com.jdgapps.andgtbrew2.DataBaseHelper.getGrainBrands(DataBaseHelper.java:175)

 E/AndroidRuntime(28296):  at
 com.jdgapps.andgtbrew2.AndGTbrew2$1.onClick(AndGTbrew2.java:92)

 W/ActivityManager(15152):   Force finishing activity
 com.jdgapps.andgtbrew2/.AndGTbrew2

 W/ActivityManager(15152): Activity pause timeout for
ActivityRecord{4280e468 com.jdgapps.andgtbrew2/.AndGTbrew2}

 I/ActivityManager(15152): Process com.jdgapps.andgtbrew2 (pid 28296) has
 died.

 ---  CUT HERE  ---

 Unfortunately, this error message doesn't tell me much, and while looking
 between tutorials and my code here, I can't see what's wrong with it.

 I tried to check in /data/data/com.jdgapps.andgtbrew2/ to see if gtbrew2.db
 was there, but /data was empty, so I gather it's hidden.  Good security,
 normally, but a PITA right now.

 Logcat does not show any of the errors that would be generated if the
 dabase copy (from assets to the above) failed, so it should be there.

 Does anyone see anything that I might have missed?

 Thanks,
--jim

 --
 THE SCORE:  ME:  2  CANCER:  0
 73 DE N5IAL (/4)  |
 spooky1...@gmail.com  | TeX actually recognizes several kinds of
  Running Mac OS X Lion  | infinity, some of which are ``more infinite''
 ICBM / Hurricane: | than others.
30.44406N 86.  59909W  |   --Donald Knuth in {The TeXbook}

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Database access error causes force close

2014-12-05 Thread Jim Graham
On Fri, Dec 05, 2014 at 10:27:56PM -0500, Steve Gabrilowitz wrote:
 You could try putting a try/catch block around the offending statement to
 catch a generic exception, maybe finding out exactly what exception pops up
 might give you a clue?

I tried that.  The catch statement, which should have logged the error,
became the new source of the force close.  And logcat did not give ANY
additional data.  :-(

I also tried deleting the database and re-creating it.  It STILL shows up
as much smaller than the copy in assets, but I'm still assuming Android
quietly does some kind of compression on it.

Thanks,
   --jim

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)MiSTie #49997   Running Mac OS X Lion 
spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W

Do not look into waveguide with remaining eye!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Database access error causes force close

2014-12-05 Thread Steve Gabrilowitz
Put a breakpoint in the catch clause and when it gets there examine the
exception - that's how I recently figured out a similiarly puzzling force
close.
 On Dec 5, 2014 10:36 PM, Jim Graham spooky1...@gmail.com wrote:

 On Fri, Dec 05, 2014 at 10:27:56PM -0500, Steve Gabrilowitz wrote:
  You could try putting a try/catch block around the offending statement to
  catch a generic exception, maybe finding out exactly what exception pops
 up
  might give you a clue?

 I tried that.  The catch statement, which should have logged the error,
 became the new source of the force close.  And logcat did not give ANY
 additional data.  :-(

 I also tried deleting the database and re-creating it.  It STILL shows up
 as much smaller than the copy in assets, but I'm still assuming Android
 quietly does some kind of compression on it.

 Thanks,
--jim

 --
 THE SCORE:  ME:  2  CANCER:  0
 73 DE N5IAL (/4)MiSTie #49997   Running Mac OS X Lion 
 spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W

 Do not look into waveguide with remaining eye!

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Android Developers group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Database access error causes force close

2014-12-05 Thread Jim Graham
On Fri, Dec 05, 2014 at 10:40:01PM -0500, Steve Gabrilowitz wrote:
 Put a breakpoint in the catch clause and when it gets there examine the
 exception - that's how I recently figured out a similiarly puzzling force
 close.

Honestly, I don't even know how to do that.  I've never run into a
situation like this, where logcat says, something happened...and it was
here.  I've always gotten more useful information either from it, or
Eclipse warnings.

The most frustrating thing about this stuff is that I'm trying to
(hopefully) use this app to make enough money to pay for advertising so
the games I'm working on (using AndEngine) will have a chance of making
money to either directly make me enough money to get out from under
Social (IN)Security Disability, which was forced on me by cancer #1, or
to make money to add to my investing, which ultimately the same goal.
The ironic part is, I can't afford to pay for advertising for the app I
hope to make money to pay for advertising so my games can have a
chance  So when you combine that with this kind of stuff, where I'm
completely at a loss, it makes for a really bad week.

Thanks,
   --jim

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)MiSTie #49997   Running Mac OS X Lion 
spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W

Do not look into waveguide with remaining eye!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.