SQLite (part deux) 1 CS440. Traditional Model View Controller (MVC) CS440 2.

Slides:



Advertisements
Similar presentations
Programming with Android: Data management
Advertisements

CE881: Mobile and Social Application Programming Flexible Data Handling with Integrity: SQLite Simon M. Lucas.
SQLite is a software library. It is: self-contained + Serverless + zero-configuration transactional = SQL database engine. Most widely deployed. The source.
Android – CoNTENT PRoViders
SQLite in Mobile Apps by Dan Youberg. Overview Many well known applications and Internet browsers use SQLite due to its very small size (~250 Kb). Also.
ContentProviders.  Databases for reading & writing data  Support typical database operations  e.g., query, insert, update & delete.
컨텐트 프로바이더 박승제. Content Provider The only way to share data across applications Using content provider Use existing content providers supplied by android.
Android course Database dr Milan Vidaković Chair of Informatics Faculty of Technical Sciences University of Novi Sad.
CONTENT PROVIDER. Content Provider  A content provider makes a specific set of the application's data available to other applications => Share data to.
Cosc 5/4730 Android and Blackberry SQLite. For the sql language syntax, please see SQlite documentation –
SQLLite and Java CS-328 Dick Steflik. SQLLite Embedded RDBMS ACID Compliant Size – about 257 Kbytes Not a client/server architecture –Accessed via function.
SQLite 1 CS440. What is SQLite?  Open Source Database embedded in Android  SQL syntax  Requires small memory at runtime (250 Kbytes)  Lightweight.
CS378 - Mobile Computing Persistence - SQLite. Databases RDBMS – relational data base management system Relational databases introduced by E. F. Codd.
Data Persistence in Android
SQLite Database. SQLite Public domain database – Advantages Small (about 150 KB) – Used on devices with limited resources Each database contained within.
Database Rung-Hung Gau Department of Computer Science and Engineering
Data Storage: Part 3 (SQLite)
Content providers Accessing shared data in a uniform way 1Content providers.
Data Storage: Part 4 (Content Providers). Content Providers Content providers allow the sharing of data between applications. Inter-process communication.
COMP 365 Android Development.  Manages access from a central database  Allows multiple applications to access the same data.
Package org.androidtown.database.query; import android.app.Activity; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase;
SQLite Android Club SQLite About onCreate Insert Select Update Delete onUpdate.
Address Book App 1. Define styles   Specify a background for a TextView – res/drawable/textview_border.xml.
9 Persistence - SQLite CSNB544 Mobile Application Development Thanks to Utexas Austin.
Persistence Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5 License.
Mobile Software Development ISCG 7424 Department of Computing UNITEC John Casey and Richard Rabeder SQLite and Permissions.
SQLite DB Storing Data in Android RAVI GAURAV PANDEY 1.
Android - SQLite Database 12/10/2015. Introduction SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with.
SQlite. SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation.
Writing Basic SQL SELECT Statements Lecture
Address Book App 1 Fall 2014 CS7020: Game Design and Development.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Data Storage in Android Димитър Н. Димитров. Why talk about data? Why not 3D graphics or network connectivity? Data as fundamental term in computer science.
Database Programming Code Dissection. Layered Approach Presentation (Activity) DbSampleActivity.java DataAccess (DataSource) CommentsDataSource.java MySQLiteHelper.java.
CS371m - Mobile Computing Persistence - SQLite. 2 In case you have not taken 347: Data Management or worked with databases as part of a job, internship,
Content Providers.
CS499 – Mobile Application Development
Making content providers
Data Storage: Part 3 (SQLite)
Content provider.
Cosc 5/4730 Sqlite primer.
Android Content Providers & SQLite
Data Storage: Part 4 (Content Providers)
Content Providers And Content Resolvers
SQLite in Android Landon Cox March 2, 2017.
Mobile Software Development for Android - I397
Mobile Application Development BSCS-7 Lecture # 18, 19
ListView: Part 2.
Mobile Applications (Android Programming)
Android Application SQLite 1.
Reactive Android Development
CS499 – Mobile Application Development
Android Database using SQLite
Content Providers.
Lecture 8: Database Topics: Basic SQLite Operations.
Chapter 5: Menus, SQLite.
Mobile Computing With Android ACST Android Database Storage Part 2
Android Programming Lecture 7
CMPE419 Mobile Application Development
CS371m - Mobile Computing Persistence - SQLite.
CMPE419 Mobile Application Development
Mobile Computing With Android ACST 4550 Android Database Storage
Android Developer Fundamentals V2
ListView A view that shows items in a vertically scrolling list. The items come from the ListAdapter associated with this view. ListAdapter is used to.
Department of School of Computing and Engineering
SQLLite and Android.
Lecture 8: Database Topics: Basic SQLite Operations.
Mobile Programming Dr. Mohsin Ali Memon.
Presentation transcript:

SQLite (part deux) 1 CS440

Traditional Model View Controller (MVC) CS440 2

Android: Database-centric data CS440 3

Useful classes  SQLiteDatabase is the base class for working with a SQLite database in Android. Methods:  open  query: rawQuery(), execSQL()  update  close CS440 4 Cursor cursor = getReadableDatabase(). rawQuery("select * from todo where _id = ?", new String[] { id });

Cursor  A query returns a Cursor object  Cursor can represent many objects (multiple lines)  A Cursor points to one row of the query result  You can move between multiple lines with Cursor.moveToNext()  Useful methods:  getCount()  moveToFirst(), moveToNext(), moveToPrevious()  isAfterLast()  getAs*(): eg. getAsString(int columnNumber) 5

ListViews, ListActivities, and SimpleCursorAdapter  ListViews : Views which allow to display a list of elements  ListActivities : specialized Activities which make the usage of ListViews easier  SimpleCursorAdapter : maps the columns to the Views based on the Cursor passed to it CS440 6

SQLiteOpenHelper  Provides lifecycle framework for creating and upgrading your application database  Useful methods:  String getDatabaseName()  void onOpen(SQLiteDatabase db)  abstract void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)  More on: database/sqlite/SQLiteOpenHelper.html database/sqlite/SQLiteOpenHelper.html CS440 7

SQLiteQueryBuilder  High level abstraction for creating SQL queries  Useful Methods:  Cursor query(SQLiteDatabase db, String[] projectionIn, String s election, String[] selectionArgs, String groupBy, String h aving, String sortOrder)SQLiteDatabaseString[]StringString[]String Perform a query by combining all current settings and the information passed into this method.  String buildQuery(boolean distinct, String tables, String[] columns, String where, Stri ng groupBy, String having, String orderBy, String limit)StringString[]StringStri ngString CS440 8

References  Oreilly, Programming Android, Mednieks, Dornin CS440 9