K
K
kolodach2014-02-17 17:20:48
Android
kolodach, 2014-02-17 17:20:48

SQLite for android?

For five days now I can’t figure out how to use the database for android applications. I re-read a cloud of material, coded even more, but the understanding did not come.
What you need:
1) Create a database with two columns
2) Add an element to the database
3) Read the database through the list view

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Bloch, 2014-03-04
@alexblokh

The fact is that this method involves creating extra objects, such as List, then passing over the cursor and writing new elements to the list, and then loading all this into the list.
The first step for you would be to get familiar with the CursorAdapter. It allows you to populate a ListView with a cursor. Here is a good tutorial on how to use it.
And then it would be extremely good for you to master a bunch of Content Provider'a and CursorLoadera. It will allow you to fill the table asynchronously and track changes in it in a convenient way. This method is best described in this book . I read many lessons and articles on this topic, but I managed to fully understand and implement it only after reading several chapters of this book and this oneArticles by Lars Vogell. After spending a few days and a little nerve on this, you will fully experience the increase in your skills.

K
kolodach, 2014-02-17
@kolodach

Thanks a lot! it is better to throw a database with methods in a separate class?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question