Android Application Development Tutorial - 120 - Reading SQLite Database with Cursor

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

That's the best explanation of Cursor you did right there, i came across many blogs and they all got me so confused.
This is a relief for me thank you boy.

vuthyra
Автор

These tutorials are for the most part :P

rohilsurana
Автор

Sir getdata() why show error in getdata function


Caused by: Couldn't read row 0, col -1 from CursorWindow.Make sure the Cursor is initialized correctly before accessing data from it




for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
result += c.getString(irow) + " " + c.getString(ifristname) + " " + c.getString(isecname) + "\n";
}
return result
its right but when i pressed the view button progrm automatically stopped and go back previos window

waqasakhan
Автор

I'm getting "unhandled exception" at "info.open();" in SQLView.java
after i surround it with try and catch, the program runs but when i press the 'view' button the program crashes.
any idea ?

Geekobird
Автор

Is there a better way to display the db results (like a table or a grid)? The text views/labels on top of the results are not aligned properly!

AlexChalkias
Автор

from the previous tutorials, android create a database and empty table...

what if in the first load of a database i want to have already an item?

plzz help me..

iamkenneth
Автор

When I click the view button the app is forced closed. My manifest has the SQLView class! Anyone any clue what the problem is?? 

eoinocribin
Автор

How can i print the values in a fixed position where each value aligns from its column?

Naee
Автор

Could you tell me what intent filter that it needs? I´m having this problem too. It crashes when i try to call database.query

Guitar
Автор

Can you help me, when I click the button that will display the data entry appears an error
and when I try to find or get this error I see is when creating object cursor


Elmontaser
Автор

@MJGallick i've surrounded the code with try/catch where it was doing modifications in the database and whenever i inserted some data it was giving me a exception & a number -1(in c language -1 means error so java must be the same) witch means it was not inserting the data. I've tried a lot of things that didn't worked so i just downloaded the code that is given on mybringback

LeonSon
Автор

I'm getting an error when i click the view button. I've commented the code and i've foun out that it's the cursor that is not allowing me to open that activitie. Anyone knows what can i do?

LeonSon
Автор

Sorry but how could i put the results in a listview???
I also want to click on item to retrieve its id...

zaksdc
Автор

For looping through the cursor, why can we not simply have:
while(c.moveToNext) {

}
moveToNext returns true only when cursor has something to move on to.
I tried that and it worked just fine, so it seems correct. But I'm not sure if I might be missing something (because I'm still an android noob). It'd be nice if anyone else can confirm.

sliderBro
Автор

please help.. my application closes wen i try to view the database.. :(

" Using default keymap:
what does ds mean?

asitis
Автор

How can we format that display since headings and data don't look well on emulator

burakkocakeu
Автор

I did everything you guys said but still, my view button doesn't work. :( Can someone please help me?

astroneko_VIP
Автор

did it the same way like you, but it don't work. I find out that the database.query method is the reason for the error, but i can't find any details. tried one of the other query methods (with a boolean as first parameter), but nothing worked, the Database must exist, cause the dialog was displayed, when I created the table. Can anyone help me??

TheChrisivogt
Автор

did you write "cv.put(KEY_HOTNESS)" when you created an entry in the database?

TheChrisivogt
Автор

Hi Travis, here asking for help I am traing to read and String form my SQLite, in the tutorial you search by id, but how can we search by name like writing in the EditText the name of the person.
And congrats for the tutorials

JoussAlonso
welcome to shbcf.ru