Android Application SQLite 1.

Slides:



Advertisements
Similar presentations
MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
Advertisements

Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
Access Lesson 2 Creating a Database
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Concepts of Database Management Sixth Edition
Concepts of Database Management Sixth Edition
Database Updates Made Easy In WebFocus Using SQL And HTML Painter Sept 2011 Lender Processing Services 1.
CS378 - Mobile Computing Persistence - SQLite. Databases RDBMS – relational data base management system Relational databases introduced by E. F. Codd.
Access Tutorial 10 Automating Tasks with Macros
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.
1 Insert, Update and Delete Queries. 2 Return to you Address Book database. Insert a record.
Lesson No:9 MS-Word Tools, Mail Merge and working with Tables CHBT-01 Basic Micro process & Computer Operation.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Content providers Accessing shared data in a uniform way 1Content providers.
COMP 365 Android Development.  Manages access from a central database  Allows multiple applications to access the same data.
® Microsoft Access 2010 Tutorial 1 Creating a Database.
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.
Concepts of Database Management Seventh Edition
Chapter 17 Creating a Database.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 33 Advanced Java.
® Microsoft Office 2013 Access Creating a Database.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
Persistence Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5 License.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
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.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Address Book App 1 Fall 2014 CS7020: Game Design and Development.
CHAPTER 9 File Storage Shared Preferences SQLite.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
Data Storage in Android Димитър Н. Димитров. Why talk about data? Why not 3D graphics or network connectivity? Data as fundamental term in computer science.
1. 2 The Address Book app provides convenient access to contact information that’s stored in a SQLite database on the device. You can: scroll through.
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.
3 A Guide to MySQL.
Access Tutorial 2 Building a Database and Defining Table Relationships
Tutorial 1 Creating a Database
Databases.
Databases and SQL Designing a database with tables and primary keys
SQLite in Android Landon Cox March 2, 2017.
Access Tutorial 1 Creating a Database
Practical Office 2007 Chapter 10
Mobile Applications (Android Programming)
Microsoft Office Access 2003
SQL MODELER - OPEN There are Three Ways to open the SQL Modeler
Mobile Application Development Chapter 5 [Persistent Data in Android]
Access Creating a Database
Chapter 4 MS ACCESS DATABASE.
Access Creating a Database
Building and Using Queries
Access Lesson 1 Understanding Access Fundamentals
Access Tutorial 1 Creating a Database
Access Lesson 2 Creating a Database
CS371m - Mobile Computing Persistence - SQLite.
Mobile Computing With Android ACST 4550 Android Database Storage
Creating and Managing Database Tables
This presentation document has been prepared by Vault Intelligence Limited (“Vault") and is intended for off line demonstration, presentation and educational.
Displaying and Editing Data
Android Developer Fundamentals V2
Access Tutorial 1 Creating a Database
Access Tutorial 1 Creating a Database
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.
Grauer and Barber Series Microsoft Access Chapter One
SQLLite and Android.
Mobile Programming Dr. Mohsin Ali Memon.
Unit J: Creating a Database
Presentation transcript:

Android Application SQLite 1

Databases RDBMS Relational databases introduced by E. F. Codd relational data base management system Relational databases introduced by E. F. Codd Turing Award Winner Relational Database data stored in tables relationships among data stored in tables data can be accessed and view in different ways

SQL and SQLite Structured Query Language programming language to manage data in a RDBMS(Relational database management system) SQLite implements most, but not all of SQL SQLite becomes part of application

SQLite and Android Databases created with or for application accessible by name to all classes in application, but none outside application Creating database: create subclass of SQLiteOpenHelper and override onCreate() method execute SQLite command to create tables in database

Creating Database Example: Movie Rating App Stores user ratings Not a complex example Database only has one table Adapted from Deitel Address Book Application http://www.deitel.com/Books/Android/ AndroidforProgrammers/tabid/3606/Default.aspx

MovieRaterActivity Starting Activity Classes MovieRaterActivity Starting Activity Displays List of RatedMovies click on Movie Title menu - Add Rating ViewRating Show Rating and Information AddEditRating Add or Edit Rating menu - Edit Rating menu - Delete Rating DatabaseConnector Interact With Database Row remove from database

MovieRaterActivity ScrollView Queries data base for all names / titles Clicking on Title brings up that rating in ViewRating

Menu for MovieRaterActivity Only one menu option button to Add Rating Brings up AddEditRating Activity

ViewRating Pulls all data from database for row based on name / title Use of a RatingBar ViewRating has its own Menu

ViewRating Menu Edit Rating starts AddEditRating activity and populates fields with these values (place in Extras) Delete Rating brings up confirmation Dialog

AddEditRating Add Rating fields are blank Consider adding a button for date picker instead of typing data Must enter title / name other fields can be blank

AddEditRating When title clicked in main Activity, MovieRaterActivity Make changes and click save

DatabaseConnector Class Start of class

DatabaseConnector Class

Creating Database Via an inner class that extends SQLiteOpenHelper

Creating Database Money method

Creating Database String is a SQLite command ratings is name of table table has seven columns _id, name, genre, dateSeen, tag1, tag2, rating storage classes for columns: TEXT, INTEGER, REAL also NULL and BLOB _id is used as primary key for rows

Database on Device can pull database and view sqlitebrowser is a good tool

Inserting Data ContentValues are key/value pairs that are used when inserting/updating databases Each ContentValue object corresponds to one row in a table _id being added and incremeneted automatically

Inserting Data In AddEditRating When save button clicked

Inserting Data In DatabaseConnector nullCoumnHack, for inserting empty row

Updating Data In AddEditRating When save button clicked notice id added

Updating Data In DatabaseConnector

Query Data Getting a single row by _id in order to populate ViewRating

Query Data Get all rows To populate the ListView in the MovieRaterActivity only getting _id and name columns

Deleting Data Menu Option in ViewRating

Database Cursor Cursor objects allow random read - write access to the result of a database query Ours only used to read the data Use a CursorAdapter to map columns from cursor to TextView or ImageViews defined in XML files

Database Connection Recall:

MovieRaterActivity Rating Adapter is a CursorAdapter from onCreate method

Other Cursor Options moveToPrevious getCount getColumnIndexOrThrow getColumnName getColumnNames moveToPosition getPosition

Possible Upgrades Add functionality to show all movies that share a particular genre movies from a date range shared tags Just more complex data base queries