Tài liệu Android Database Programming pdf

212 692 1
Tài liệu Android Database Programming pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... custom SQLite database Preface Chapter 3, SQLite Queries, is designed to be a cursory overview of the SQL query language It teaches the reader how to construct powerful database queries, which can then be used with any SQLite database Chapter 4, Using Content Providers, expands upon the previous SQLite database chapters by showing the reader how to expose his/her database to the entire Android OS through... with databases and other backend design concepts, but who may want to see these concepts applied to mobile applications Developers who are experienced with mobile applications and/or the Android platform, but who may not be as familiar with backend systems and designing/implementing database schemas, will also find this book useful Even for those who are already experienced in Android programming and database. .. Preface When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold: Any command-line input or output is written as follows: adb –s emulator-xxxx shell New terms and important... SQLite databases are SQL (Structured Query Language) is a programming language designed especially for managing data in relational databases Relational databases allow you to submit insert, delete, update, and get queries, while also allowing you to create and modify schemas (more simply thought of as tables) SQLite then is simply a scaled-down version of MySQL, PostgreSQL, and other popular database. .. accessible by a wide variety of programming languages across a wide variety of platforms (including our very own Android platform) For now, let's simply take a look at how we would instantiate a new SQLite database schema and create a very simple table with this code snippet: public class SQLiteHelper extends SQLiteOpenHelper { private static final String DATABASE_ NAME = "my _database. db"; // TOGGLE THIS... TABLES AND DATABASE [ 20 ] Chapter 1 private static final int DATABASE_ VERSION = 1; // NAME OF TABLE YOU WISH TO CREATE public static final String TABLE_NAME = "my_table"; // SOME SAMPLE FIELDS public static final String UID = "_id"; public static final String NAME = "name"; SQLiteHelper(Context context) { super(context, DATABASE_ NAME, null, DATABASE_ VERSION); } @Override public void onCreate(SQLiteDatabase... covers Chapter 1, Storing Data on Android, focuses on all the different local data storage methods available on Android It provides ample code examples of each storage method, as well as a comparison of the strengths and weaknesses of each Chapter 2, Using a SQLite Database, takes a deeper dive into the most complex and most commonly used form of local data storage—the SQLite database by walking you through... book, and shows the reader how to connect their mobile application with their external database, and ultimately parse and display the HTTP response as a list [2] Preface What you need for this book The requirements for this book include a working knowledge of the Android OS, a programming IDE capable of creating both Android and Google App Engine projects (that is Eclipse), as well as a stable internet... on internal and external storage mechanisms and dive right into the even heftier topic of SQLite databases SQLite databases Last, but not least, by far the most sophisticated and, arguably, the most powerful method for local storage is with SQLite databases Each application is equipped with its own SQLite database, which is accessible by any class in the application, but not by any outside applications... name column [ 23 ] Storing Data on Android Afterwards, we go back to our SQLiteDatabase object and call its insert() method The first argument is simply the name of the database, and the third argument is the ContentValue we just created The second argument is the only tricky one — basically, in the event that an empty ContentValue is passed in, because a SQLite database cannot insert an empty row, .

Ngày đăng: 14/02/2014, 18:20

Từ khóa liên quan

Mục lục

  • Cover

  • Copyright

  • Credits

  • About the Author

  • About the Reviewers

  • www.PacktPub.com

  • Table of Contents

  • Preface

  • Checking when the application last updated itself

  • Remembering what the user's login username was

  • Remembering an application's state

  • Caching a user's location

  • Internal storage methods

  • External storage methods

  • SQLite databases

  • Summary

  • Chapter 2: Using a SQLite Database

    • Creating advanced SQLite schemas

    • Wrappers for your SQLite database

    • Debugging your SQLite database

    • Summary

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan