Android Tutorial
By : Ketan Bhimani 300 The following code gets a File object for the /cache application subdirectory, creates a new file in th ...
Android Tutorial 301 Here we focus on creating databases within our Android applications. For that, we use the built-in SQLite s ...
By : Ketan Bhimani 302 import android.database.sqlite.SQLiteDatabase; ... SQLiteDatabase mDatabase; mDatabase = openOrCreateDa ...
Android Tutorial 303 following is a valid CREATE TABLE SQL statement. This statement creates a table called tbl_authors. The tab ...
By : Ketan Bhimani 304 private static final String CREATE_TRIGGER_ADD = “CREATE TRIGGER fk_insert_book BEFORE INSERT ON tbl_bo ...
Android Tutorial 305 You might want to create simple classes (that is, class Author and class Book) to encapsulate your applicat ...
By : Ketan Bhimani 306 Because we are not updating the other fields, we do not need to include them in the ContentValues objec ...
Android Tutorial 307 public void deleteBooksByAuthor(Integer authorID) { int numBooksDeleted = mDatabase.delete(“tbl_books”, “au ...
By : Ketan Bhimani 308 read-only database, you can open the database and retry your operations. Finally, note that transaction ...
Android Tutorial 309 database columns. These might include calculated columns, column aliases, and composite columns. Cursor obj ...
By : Ketan Bhimani 310 If you’re lazy, like us, and you don’t want to bother handling these lifecycle events, you can hand off ...
Android Tutorial 311 information (name and number of columns). Next, it iterates through the query results, printing each record ...
By : Ketan Bhimani 312 Sample log output for the logCursorInfo() method. The query() method we mainly use takes the following ...
Android Tutorial 313 SELECT * tbl_books WHERE id=9; Selecting all results might be fine for tiny databases, but it is not terrib ...
By : Ketan Bhimani 314 import android.database.sqlite.SQLiteQueryBuilder; ... SQLiteQueryBuilder queryBuilder = new SQLiteQuer ...
Android Tutorial 315 returns a Cursor of results. If you know your SQL and you don’t want to bother learning the ins and outs of ...
By : Ketan Bhimani 316 We make the substrings (ow) into selection arguments, so we can use this same code to look for other su ...
Android Tutorial 317 Designing Persistent Databases Generally speaking, an application creates a database and uses it for the re ...
By : Ketan Bhimani 318 import android.provider.BaseColumns; public final class PetDatabase { private PetDatabase() {} public s ...
Android Tutorial 319 public void onCreate(SQLiteDatabase db) { db.execSQL(“CREATE TABLE “ +PetType.PETTYPE_TABLE_NAME+” (“ PetT ...
«
11
12
13
14
15
16
17
18
19
20
»
Free download pdf