andbook!.pdf - Learning Android Get an anddev.org - Android-Shirt Back to index
anddev.org Header Logo
FAQ Search Top rated articles Browse Feeds anddev.org - Authors Contact Details Register Log in

Working with the SQLite-Database - Cursors

Goto page Previous  1, 2, 3, 4  Next
 
       anddev.org - Android Development Community | Android Tutorials | Index -> Novice Tutorials
Author Message
res
Senior Developer


Joined: 20 Nov 2007
Posts: 147
Location: United States

PostPosted: Fri Feb 15, 2008 4:46 pm    Post subject: Reply with quote

With m5 you can use rawQuery to execute the plusminus example, the method naming has been changed.
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Fri Feb 15, 2008 6:41 pm    Post subject: Reply with quote

Hello res,

yes you are right, I've just seen it to. But for standard-selects it is probably saver, because it internally adds commas and brackets ^^. But rawQuery is probably a bit faster.
res wrote:
With m5 you can use rawQuery to execute the plusminus example, the method naming has been changed.


Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sportsdude11751
Freshman


Joined: 30 Jan 2008
Posts: 7

PostPosted: Sat Feb 16, 2008 11:19 pm    Post subject: Reply with quote

man so I've got your source, compiled it and it worked fine. Then after a few compiles later, all I get is an empty white screen instead of the list of 2 names..what's goin on?
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Sun Feb 17, 2008 1:32 pm    Post subject: Reply with quote

Hello Sportsdude11751,

every run the list should have become larger... (because we were only inserting datasets and never deleting one).

So you changed really nothing Question

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sportsdude11751
Freshman


Joined: 30 Jan 2008
Posts: 7

PostPosted: Mon Feb 18, 2008 2:15 am    Post subject: Reply with quote

Yeah, the list did get longer the times I ran it, then it quit working and not giving me any names. So (just to be sure) I re-downloaded the source code and put it into eclipse and still wouldn't function =\
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Mon Feb 18, 2008 9:45 am    Post subject: Reply with quote

Hello Sportsdude11751,

what happens to the cursor when you debug the code Question

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sportsdude11751
Freshman


Joined: 30 Jan 2008
Posts: 7

PostPosted: Mon Feb 18, 2008 5:27 pm    Post subject: Reply with quote

I haven't debugged. I only use eclipse for android, so I wasn't aware of a debug option. Where is it at?
Back to top
View user's profile Send private message
res
Senior Developer


Joined: 20 Nov 2007
Posts: 147
Location: United States

PostPosted: Mon Feb 18, 2008 5:58 pm    Post subject: Reply with quote

Sportsdude11751 wrote:
I haven't debugged. I only use eclipse for android, so I wasn't aware of a debug option. Where is it at?


You can debug via eclipse, next to the run button you'll see a little bug which will run your application in debug mode. You can also access debug mode via "Run" on the toolbar and scrolling down to the debug option.

Secondly you can use logcat via the emulator to capture messages. You need to 'adb shell' into the emulator from the command line then type 'logcat', you'll see all kinds of interesting information. Their are various logcat commands so its best to look at the android documentation.

The best place to start would be http://code.google.com/android/intro/installing.html#debugging
Back to top
View user's profile Send private message
Katharnavas
Senior Developer


Joined: 04 Dec 2007
Posts: 100
Location: India

PostPosted: Tue Feb 19, 2008 5:32 am    Post subject: Reply with quote

What i hope is the database got crashed.. try -wipe -data ?
Back to top
View user's profile Send private message Yahoo Messenger
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Tue Feb 19, 2008 4:34 pm    Post subject: Reply with quote

Katharnavas wrote:
What i hope is the database got crashed.. try -wipe -data ?


it helps on so much problems Rolling Eyes

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sportsdude11751
Freshman


Joined: 30 Jan 2008
Posts: 7

PostPosted: Wed Feb 20, 2008 5:03 am    Post subject: Reply with quote

Here is some [not all] of what the LogCat generated. I put in bold what I think the problem is. I wasn't sure how to use the -wipe -data, so I put that in the emulator command line, so when I ran the emulator it executed that? I've removed the -wipe -data from the command line and re-ran and still same problem (after restarting eclipse too)

Code:
I/ActivityThread(550): Loading code package web2.help (in web2.help)
D/SystemClock(506): Setting time of day to sec=1203483448
W/SystemClock(506): Unable to set rtc to 1203483448: Invalid argument
D/ActivityThread(550): Performing launch of ActivityRecord{400db2f8 {web2.help/web2.help.AccountManager2}}
D/ActivityThread(505): Installing external provider contacts;call_log: com.google.android.providers.contacts.ContactsProvider
I/ActivityThread(525): Loading code package com.google.android.googleapps (in com.google.process.content)
[b]E/Database(550): Failed to open database file "databases/myCoolDB_2" - unable to open database file
E/Database(550): Failed to open database file "databases/myCoolDB_2" - unable to open database file[/b]
W/ActivityManager(465): activityPaused called for HistoryRecord{40176d70 {com.google.android.home/com.google.android.home.Home}} but currently pausing null
D/Sync(465): received data connection state changed: DISCONNECTED
D/Sync(465): received data connection state changed: DISCONNECTED
D/ActivityThread(525): Creating service com.google.android.googleapps.GoogleLoginService
I/ActivityManager(465): Displayed activity {web2.help/web2.help.AccountManager2}: 2817 ms
I/ActivityManager(465): Done launching {web2.help/web2.help.AccountManager2}: 2863 ms
I/SurfaceFlinger(465): Boot is finished (0 ms)
D/ActivityManager(465): Stopping: HistoryRecord{40176d70 {com.google.android.home/com.google.android.home.Home}}
I/ActivityThread(465): Loading code package android (in null)
I/ARMAssembler(465): generated scanline__00000077:03545404_00000A04_00000000 [ 29 ipp] (51 ins) at [0x176a00:0x176acc] in 273676872 us
I/dalvikvm-heap(506): GC!
W/SurfaceFlinger(465): LayerVector[0x1149a8, counts=(3,3)]: layer (0x1262f8, index=0) not found (not a bug)
I/dalvikvm-gc(506): freed 6054 objects / 383736 bytes
I/dalvikvm-heap(506): Current GC heap soft limit utilization 737/1000 (1.026MB / 1.392MB) (real 2.062MB)
I/dalvikvm-heap(506): GC heap soft limit grew from 1.392MB to 2.052MB
I/ActivityManager(465): Done launching {com.google.android.home/com.google.android.home.Home}: 8118 ms
D/ActivityThread(525): Creating service com.google.android.providers.media.MediaScannerService
D/MediaScannerService(525): start scanning /system/media
I/ActivityThread(525): Loading code package com.google.android.xmppService (in com.google.process.content)
D/TelephonyProvider(506): Setting numeric '310995' to be the current operator
D/Sync(465): received data connection state changed: CONNECTING
D/Sync(465): received data connection state changed: CONNECTING
D/Sync(465): received data connection state changed: CONNECTED
D/MediaScanner(525):  prescan time: 277ms
D/MediaScanner(525):     scan time: 11ms
D/MediaScanner(525): postscan time: 0ms
D/MediaScanner(525):    total time: 288ms
D/MediaScannerService(525): done scanning /system/media
I/ActivityManager(465): Stopping service: {com.google.android.providers.media/com.google.android.providers.media.MediaScannerService}
D/ActivityThread(525): Stopping service com.google.android.providers.media.MediaScannerService@4011be38
[i]
Back to top
View user's profile Send private message
Katharnavas
Senior Developer


Joined: 04 Dec 2007
Posts: 100
Location: India

PostPosted: Wed Feb 20, 2008 5:08 am    Post subject: Reply with quote

Better you post the whole source so that one can replicate the problem and help you !
Back to top
View user's profile Send private message Yahoo Messenger
res
Senior Developer


Joined: 20 Nov 2007
Posts: 147
Location: United States

PostPosted: Wed Feb 20, 2008 7:07 am    Post subject: Reply with quote

If you use -wipe-data you will need to recreate your database, from the error message Android is unable to locate myCoolDB_2.
Back to top
View user's profile Send private message
Katharnavas
Senior Developer


Joined: 04 Dec 2007
Posts: 100
Location: India

PostPosted: Wed Feb 20, 2008 7:13 am    Post subject: Reply with quote

res wrote:
If you use -wipe-data you will need to recreate your database, from the error message Android is unable to locate myCoolDB_2.


Better you check from the command line also whether database , table and any data inside table is available.
Back to top
View user's profile Send private message Yahoo Messenger
Sportsdude11751
Freshman


Joined: 30 Jan 2008
Posts: 7

PostPosted: Wed Feb 20, 2008 7:56 am    Post subject: Reply with quote

The source code I used was plusminus's source. I will copy and paste it next time I can get on that computer.
Even if it can't find the database, in +-'s source he had a create database statement.
Back to top
View user's profile Send private message
Display posts from previous:   
       anddev.org - Android Development Community | Android Tutorials | Index -> Novice Tutorials All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


© 2007, Android Development Community
All rights reserved.
Powered by phpBB.