CHAPTER 9 File Storage Shared Preferences SQLite.

Slides:



Advertisements
Similar presentations
Bruce Scharlau, University of Aberdeen, 2012 Data storage options for mobiles Mobile Computing.
Advertisements

Chapter 10: Designing Databases
 data/data-storage.html#pref data/data-storage.html#pref 
Information systems and databases Database information systems Read the textbook: Chapter 2: Information systems and databases FOR MORE INFO...
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
CS378 - Mobile Computing Persistence - SQLite. Databases RDBMS – relational data base management system Relational databases introduced by E. F. Codd.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
Data Persistence in Android
Data Access Patterns. Motivation Most software systems require persistent data (i.e. data that persists between program executions). In general, distributing.
Data Storage: Part 1 (Preferences)
SQLite Database. SQLite Public domain database – Advantages Small (about 150 KB) – Used on devices with limited resources Each database contained within.
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
CHP - 9 File Structures. INTRODUCTION In some of the previous chapters, we have discussed representations of and operations on data structures. These.
Databases and LINQ Visual Basic 2010 How to Program 1.
Android development basics Introduction,Structure,Development Boncho Valkov.Net Developer.
Chapter 15: Using LINQ to Access Data in C# Programs.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Cosc 5/4730 Android Content Providers and Intents.
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.
CS378 - Mobile Computing Persistence. Saving State We have already seen saving app state into a Bundle on orientation changes or when an app is killed.
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
Creating and using Persistent Data From before – Where does the data come from? – Why is it kept? – How is it used? Affects design and implementation choices.
Data Structure & File Systems Hun Myoung Park, Ph.D., Public Management and Policy Analysis Program Graduate School of International Relations International.
Android Storage. There are several options for storage of data with Android We can put data into a preferences file. We can put data into a ‘normal’ file.
Nilesh Singh Local Data Storage option Android provides several options for you to save persistent application data. - Shared preferences - Creation.
Data persistence How to save data using SharedPreferences, Files, and SQLite database 1Data persistence.
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.
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Database Management Systems.  Database management system (DBMS)  Store large collections of data  Organize the data  Becomes a data storage system.
1 CS 430 Database Theory Winter 2005 Lecture 2: General Concepts.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Mobile Software Development ISCG 7424 Department of Computing UNITEC John Casey and Richard Rabeder SQLite and Permissions.
Database Basics BCIS 3680 Enterprise Programming.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
SQLite DB Storing Data in Android RAVI GAURAV PANDEY 1.
Chapter 13.3: Databases Invitation to Computer Science, Java Version, Second Edition.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Building User Interfaces Basic Applications
Address Book App 1 Fall 2014 CS7020: Game Design and Development.
The HDF Group Introduction to HDF5 Session Two Data Model Comparison HDF5 File Format 1 Copyright © 2010 The HDF Group. All Rights Reserved.
CHAPTER 4 Fragments ActionBar Menus. Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to.
Chapter 9 Working with Databases. Copyright © 2011 Pearson Addison-Wesley Binding to ListBox and ComboBox Controls List and combo boxes are frequently.
Android Storage MAY 2013 Hu.Cai. NAME OF PRESENTATION [CHANGE IN SLIDE MASTER] MONTH, YEAR [CHANGE IN SLIDE MASTER] Outline 1.Storage In General 2.SharedPreferences.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
Mobile Application Development Data Storage. Android provides several options for you to save persistent application data. The solution you choose depends.
Data Storage in Android Димитър Н. Димитров. Why talk about data? Why not 3D graphics or network connectivity? Data as fundamental term in computer science.
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,
Data Persistence Chapter 9. Objectives Learn about data storage methods Understand use of Shared Preferences Understand file-based storage and the differences.
Creating Database Objects
Android Application Data Storage 1.
GO! with Microsoft Office 2016
Android Application SQLite 1.
SQL – Data types.
Android Database using SQLite
Mobile Application Development Chapter 5 [Persistent Data in Android]
GO! with Microsoft Access 2016
Building User Interfaces Basic Applications
HTML5 and Local Storage.
Mobile Programming Dr. Mohsin Ali Memon.
Creating Database Objects
Presentation transcript:

CHAPTER 9 File Storage Shared Preferences SQLite

Chapter objectives: Data storage methods Understand what Shared Preferences are used for Key-value pairs File-based Storage The differences between internal storage and external storage How to build applications using SQLite databases

9.1 Storing Data Applications often store information about a user’s preferences in order to provide a more sophisicated level of personalization and responsiveness A user can log into and out of an application and have it remember them when the application is relaunched Users expect to choose settings according to their personal needs, such as specific background sounds and images, and have them automatically persist across user sessions

Advanced applications are frequently data- driven and require the management of a larger volume of data Databases and files can be used by an application to store structured data or information that will be made available to other applications

Choosing the manner in which data is stored depends upon the specific needs of the application, such as the amount of data that needs to be stored and whether the data will be kept private The Android platform allows data files to be saved on the device’s internal memory and on an external storage media Files that are saved within the device’s internal storage memory tend to be small, as opposed to external storage, which typically holds larger volume files

9.2 Shared Preferences Shared Preferences refers to the storage of a limited set of primitive data used to make persistent changes in an Android application A simple way to read and write key-value pairs of data Used to store a user’s personal settings and a small amount of application session data SharedPreference information is backed up in XML files in internal storage Proprietary and inaccessible to outside applications

Allows preference data values to automatically persist throughout sessions, regardless of how they end This includes exit of an application, shutdown of the device, or system crash

A key-value pair is a data representation model that uses a set of key identifiers along with associated data values Model is frequently used in hash tables and configuration files Provides access to a data value or object by specifying its associated key SharedPreferences API provides a set of methods for reading and writing key-value pairs to files Shared preferences supports the String data type and Java primitive data types, such as int, float, long, and boolean

9.3 File Storage – Internal and External Storage In Android, a file-based storage option allows data to be written to an actual file structure This storage method requires more control regarding read and write permissions Internal storage allows data to be stored directly onto the device’s memory This storage is always available, assuming there is space External storage may not always be obtainable on a device.

There are significant differences in how external and internal storage is utilized in an application Internal storage files can be configured to be readable and writeable by the application Typically, internal storage is utilized when processing an image, video and audio elements, and large data files By default, files saved to internal storage are private to the application

External storage is publicly shared storage, which means that it can be made available to external applications Unlike internal storage, once an application is uninstalled, external storage files will continue to exist

9.4 Android Database with SQLite SQLite provides the foundation for managing private and embedded databases in an Android application The Android SDK includes the SQLite software library that implements the SQL (Structured Query Language) database engine This library is used for defining the database structure and adding and managing the database content as required by the application The Android SDK also includes an SQLite database tool for explicit database debugging purposes

As a condensed version of SQL (Structured Query Language), SQLite supports the standard SQL syntax and database transactions Though SQLite is not a full-featured database, it supports a large set of the SQL standard and is sufficient for Android developers needing a simple database engine to plug into their applications

An SQLite database file is a collection of data organized in a table The SQLite database table is structured by a set of rows and columns A row represents a single record, the implicitly structured data entry in the table A column represents a data field, an attribute of a data record A field is a single item that exists at the intersection between one row and one column

The possible data types for an individual field of data consist of NULL, INTEGER, REAL, TEXT, and BLOB BLOB is a data type used to store a large array of binary data (bytes) SQLite does not provide specific data storage classes for values that need to be represented as Boolean, date, or time. Instead, these values can be stored as an INTEGER or TEXT

An outline for a students database table schema

9.5 SQLiteOpenHelper The Android SDK provides a set of classes for working with SQLite databases SQLiteOpenHelper is essential for the creation and management of database content, as well as database versioning In an Android SQLite application, SQLiteOpenHelper must be subclassed It must contain the implementation of onCreate() and onUpgrade()

9.6 Adapters and AdapterViews An Adapter object is a mechanism that binds a data source, such as a database, to an AdapterView An AdapterView is a container widget that is populated by a data source, determined by an Adapter Common AdapterViews are ListViews, GridViews, and Spinners

A ListView is an AdapterView that provides a simple approach for an application to display a scrolling list of records These records can be displayed with a default format, using a built-in style, or customized extensively As an AdapterView, a ListView object requires an Adapter to provide it with data A ListView consists of a collection of sequential items.