CS378 -Mobile Computing. Persistence -SQLite

Similar documents
CS371m - Mobile Computing. Persistence - SQLite

How-to s and presentations. Be prepared to demo them in class. ons

Android Programming Lecture 16 11/4/2011

Android Programming Lecture 15 11/2/2011

Accelerating Information Technology Innovation

SQLite. 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 6: Working with Databases. What is a Database Server. Advantages of SQLite

CS 403X Mobile and Ubiquitous Computing Lecture 5: Web Services, Broadcast Receivers, Tracking Location, SQLite Databases Emmanuel Agu

The Basis of Data. Steven R. Bagley

Content Provider. Introduction 01/03/2016. Session objectives. Content providers. Android programming course. Introduction. Built-in Content Provider

Database Development In Android Applications

Android Programming - Jelly Bean

SQLite Database. References. Overview. Structured Databases

Mobile Application Development Android

CS 528 Mobile and Ubiquitous Computing Lecture 4b: Face Detection, recognition, interpretation + SQLite Databases Emmanuel Agu

Data storage and exchange in Android

Mobile Computing Practice # 2d Android Applications Local DB

1. Implementation of Inheritance with objects, methods. 2. Implementing Interface in a simple java class. 3. To create java class with polymorphism

Developing Android Applications Introduction to Software Engineering Fall Updated 1st November 2015

Mobile Application Development Android

Required Core Java for Android application development

CS 4518 Mobile and Ubiquitous Computing Lecture 6: Databases, Camera, Face Detection Emmanuel Agu

Mobile App Design Project Doodle App. Description:

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu

CS371m - Mobile Computing. Content Providers And Content Resolvers

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Android Programming (5 Days)

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Introduction to pysqlite

Android Components. Android Smartphone Programming. Matthias Keil. University of Freiburg

An Android Studio SQLite Database Tutorial

07. Data Storage

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu

Mobile Application Development Android

Mobile Programming Lecture 10. ContentProviders

Android Components Android Smartphone Programming. Outline University of Freiburg. Data Storage Database University of Freiburg. Notizen.

SharedPreference. <map> <int name="access_count" value="3" /> </map>

DB tutorial using Database.NET dbforge Studio Express and SQLiteSpy

MC Android Programming

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review)

ListView (link) An ordered collection of selectable choices. key attributes in XML:

Building User Interface for Android Mobile Applications II

Java Training Center - Android Application Development

Purpose: Use this document to Update a Letter Template and Add Merge Fields to a letter template.

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University

CS371m - Mobile Computing. User Interface Basics

Mobile User Interfaces

Parameterizing an iway Data Quality Server SQL Statement From an Input File or the Command Line

Presentation Outline 10/16/2016

Relational Model, Key Constraints

android application development CONTENTS 1.1 INTRODUCTION TO O ANDROID OPERATING SYSTEM... TURES Understanding the Android Software Stack...

LECTURE 08 UI AND EVENT HANDLING

CS143: Relational Model

Enterprise Reporting -- APEX

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language

Import and Export Explorer Queries

Data! CS 133: Databases. Goals for Today. So, what is a database? What is a database anyway? From the textbook:

CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu

Spring Lecture 5 Lecturer: Omid Jafarinezhad

Mobile Computing Practice # 2c Android Applications - Interface

Developing Android Applications

AND-401 Android Certification. The exam is excluded, but we cover and support you in full if you want to sit for the international exam.

Mumbai Android Bootcamp -Course Content

Android Application Development using Kotlin

CSCU9YH: Development with Android

COLUMN DATABASES A NDREW C ROTTY & ALEX G ALAKATOS

07. Menu and Dialog Box. DKU-MUST Mobile ICT Education Center

CS371m - Mobile Computing. More UI Action Bar, Navigation, and Fragments

Android Application Development 101. Jason Chen Google I/O 2008

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Data-Driven Views and Android Components Emmanuel Agu

Hash Tables. Nate Foster Spring 2018

Forms iq Designer Training

Enterprise Smart Outlet: Android Development

Topics. History. Architecture. MongoDB, Mongoose - RDBMS - SQL. - NoSQL

Introduction to Data Management CSE 344. Lecture 2: Data Models

Application Fundamentals

CS 2340 Objects and Design

CS371m - Mobile Computing. More UI Navigation, Fragments, and App / Action Bars

Screen Slides. The Android Studio wizard adds a TextView to the fragment1.xml layout file and the necessary code to Fragment1.java.

CS108 Lecture 19: The Python DBAPI

ANDROID SYLLABUS. Advanced Android

CS 4330/5390: Mobile Application Development Exam 1

Vicki Wayne Advanced Reporting Datasets and Charts

WebAssist Free ecommerce MySQL database (Optional)

CS378 -Mobile Computing. Intents

Mobile and Ubiquitous Computing: Android Programming (part 4)

Using Relational Databases for Digital Research

Understanding and Working with the OGC Geopackage. Keith Ryden Lance Shipman

Adapter.

Lab 1 - Setting up the User s Profile UI

SQLite. Nov 14, CS445 Pacific University 1 11/14/11

Android Essentials with Java

CS434 Notebook. April 19. Data Mining and Data Warehouse

Introduction to SQL Server 2005/2008 and Transact SQL

Eng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza. Data persistence

CS 403X Mobile and Ubiquitous Computing Lecture 3: Introduction to Android Programming Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 1b: Introduction to Android. Emmanuel Agu

Programming and Database Fundamentals for Data Scientists

Android Programming in Bluetooth Cochlea Group

Persistence Designer User s Guide. Version 3.4

Transcription:

CS378 -Mobile Computing Persistence -SQLite

Databases RDBMS 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 2

SQL and SQLite Structured Query Language programming language to manage data in a RDBMS SQLite implements most, but not all of SQL SQLite becomes part of application 3

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 SQLiteOpenHelperand override oncreate() method execute SQLite command to create tables in database 4

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

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

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

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

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

ViewRatingMenu Edit Rating starts AddEditRatingactivity and populates fields with these values (place in Extras) Delete Rating brings up confirmation Dialog 10

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

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

DatabaseConnectorClass Start of class 13

DatabaseConnectorClass 14

Creating Database Via an inner class that extends SQLiteOpenHelper 15

Money method Creating Database 16

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 17

Database on Device can pull database and view sqlitebrowseris a good tool 18

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

In AddEditRating Inserting Data When save button clicked 20

Inserting Data In DatabaseConnector nullcoumnhack, for inserting empty row 21

Updating Data In AddEditRating When save button clicked notice id added 22

Updating Data In DatabaseConnector 23

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

Query Data Get all rows To populate the ListViewin the MovieRaterActivity only getting _id and name columns 25

Deleting Data Menu Option in ViewRating 26

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 CursorAdapterto map columns from cursor to TextView or ImageViews defined in XML files 27

Database Connection Recall: 28

MovieRaterActivity Rating Adapter is a CursorAdapter from oncreatemethod 29

Updating Cursor Cursor initially null separate task to create cursor and update adapter 30

AsynchTask 31

Clicking on Item in List _id not displayed but still part of entry in list -> use _id to get back to database row 32

Other Cursor Options movetoprevious getcount getcolumnindexorthrow getcolumnname getcolumnnames movetoposition getposition 33

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 34