Note that there are some explanatory texts on larger screens.

plurals
  1. POI just started working with SQLite for the first time and I'm very confused about some things
    primarykey
    data
    text
    <p>I've watched countless tutorials and examples about SQLite on Android but I just don't get some things. could someone please explain some things to me?</p> <p>This the code that I came up with until now (SQLite helper):</p> <pre><code>public class SQLiteHelper extends SQLiteOpenHelper { public static String DATABASE_NAME = "urnik"; public static int DATABASE_VERSION = 1; public SQLiteHelper(Context context, String name, CursorFactory factory, int version) { super(context, DATABASE_NAME, factory, DATABASE_VERSION); } //Tabela prva ura public static String IME_TABELE = "prva_ura"; public static String ID_PREDMETA = "id_predmeta"; public static String NAZIV_PREDMETA = "naziv_predmeta"; String prva_query = "CREATE TABLE " + IME_TABELE + " (" + ID_PREDMETA + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NAZIV_PREDMETA + " TEXT" + ");"; @Override public void onCreate(SQLiteDatabase db) { db.execSQL(prva_query); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { onCreate(db); } </code></pre> <p>So as far as I know, this should create a new database and one table called "prva_ura". But I have a lot of questions about this.</p> <ul> <li><p>I only created this class, I haven't attached it to MainActivity or anything, will the database still be created when app is ran for the first time or do I have to do something else?</p></li> <li><p>I'm assuming the database is created when the app is launched for the first time after creating database. Can I find the database file anywhere to check if everything is as it's supposed to be?</p></li> </ul> <p>I'd appreciate some tips in general, thank you!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload