Nilesh Singh Local Data Storage option. 2 1. Android provides several options for you to save persistent application data. - Shared preferences - Creation.

Slides:



Advertisements
Similar presentations
Programming with Android: Data management
Advertisements

Bruce Scharlau, University of Aberdeen, 2012 Data storage options for mobiles Mobile Computing.
Parts of a Computer.
Android og persistens
 data/data-storage.html#pref data/data-storage.html#pref 
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
App Development on Android
Tracking & Login Data persistence User tracking.
Android Tutorial Android Written in Java Utilizes Dalvik VM – Just in time (JIT) compilation since Android 2.2.
NFC Inventory Android App
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
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)
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Content Providers & Services.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Tutorial 11 Installing, Updating, and Configuring Software
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
November 15, 2005ICP: Chapter 7: Files and Exceptions 1 Introduction to Computer Programming Chapter 7: Files and Exceptions Michael Scherger Department.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 5: Investigate! Android Lists, Arrays,
Content providers Accessing shared data in a uniform way 1Content providers.
Cosc 5/4730 Android Content Providers and Intents.
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.
CSCI 6962: Server-side Design and Programming Web Services.
Data Storage: Part 2 (File System). Internal Storage versus External Storage Internal storage − for private data –By default, files saved to the internal.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Recitation.
Asst Prof. Saeed Ahmadi Software Engineering CSF Kabul University 1.
PROG Mobile Java Application Development PROG Mobile Java Application Development Memory and Memory Issues Data Storage.
Android Boot Camp for Developers Using Java, 3E
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.
Data persistence How to save data using SharedPreferences, Files, and SQLite database 1Data persistence.
DataLogger For Android based on Cosm.com Presented by: Pang Zineng.
Data Persistence Nasrullah Niazi. Share Preferences The SharedPreferences class provides a general framework that allows you to save and retrieve persistent.
© 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.
Java™ How to Program, 10/e © Copyright by Pearson Education, Inc. All Rights Reserved.
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.
ANDROID AND MODEL / VIEW / CONTROLLER. Slide 2 Design Patters Common solutions to programming problems are called design patterns Design patterns are.
SQLite DB Storing Data in Android RAVI GAURAV PANDEY 1.
Multimedia Capture & storage. Introduction A rich set of API for recording of audio & video. A developer has two choices  launch the built-in app using.
© 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.
Cosc 5/4735 YouTube API. YouTube The YouTube Android Player API enables you to incorporate video playback functionality into your Android applications.
Stellar Phoenix Photo Recovery Recover Photos, Audio & Videos.
CHAPTER 9 File Storage Shared Preferences SQLite.
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.
The Flag Quiz app tests your ability to correctly identify 10 flags from various countries and territories.
Data Storage in Android Димитър Н. Димитров. Why talk about data? Why not 3D graphics or network connectivity? Data as fundamental term in computer science.
Editing a Twitter search. Viewing search results in a browser.
Data Persistence Chapter 9. Objectives Learn about data storage methods Understand use of Shared Preferences Understand file-based storage and the differences.
Mobile Applications (Android Programming)
CS371m - Mobile Computing Persistence.
Android Application Data Storage 1.
SQLite in Android Landon Cox March 2, 2017.
Android Database using SQLite
Mobile Application Development Chapter 5 [Persistent Data in Android]
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Mobile Computing With Android ACST 4550 Android Data Storage
Android training in Chandigarh. What is ADB ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator.
HOW TO TRANSFER QUICKBOOKS FILES FROM ONE COMPUTER TO ANOTHER?
Android Storage.
Favorite Twitter Searches App
Android Developer Fundamentals V2 Lesson 1
Programs and Classes A program is made up from classes
Favorite Twitter Searches App
Emerging Platform#3 Android & Programming an App
Preference Activity class
Presentation transcript:

Nilesh Singh Local Data Storage option

2 1. Android provides several options for you to save persistent application data. - Shared preferences - Creation and storage of arbitrary file types - SQLite relational databases Storage Options

3 2. The solution you choose depends on your specific needs: data should be private to your application accessible to other applications (and the user) how much space your data requires. Storage Options...(2)

4 Shared Preferences 1) Each preference is a simple key / value pair - Keys are typed as string - Individual value can be typed as one of these boolean long int Float 2) Managed through Java code or through a special preference activity 3) Stored unencrypted on disk

5 Creating Preferences in Java - The SharedPreferences class represents a set of preferences - instantiate with “mode” of MODE_PRIVATE 1) Other mode constants are available (MODE_WORLD_WRITABLE) but sharing preferences between apps is not currently supported preferences for current activity private SharedPrefences setting = getPrefences(CONTEXT.MODE_PRIVATE); a named set of preferences private SharedPrefences setting = getSharedPrefences(“pref_name”,CONTEXT.MODE_PRIVATE);

6 Using Preference Activity - Preference activity defines and writes values to disk automatically - Value can be a string, boolean or list of string - Defining in a layout XML file - Navigating to preference activity with an INTENT object

7 Shared Preferences Example

8 Files Storage 1) File can be created and read on persistent media 2) No special file type – store images, XML or data files or any thing else 3) File can be designate for internal(local to app) or external storage

9  Android can save files directly to the device internal storage.  These files are private to the application and will be removed if you uninstall the application.  We can create a file using openFileOutput() with parameters as file name and the operating mode. Internal Storage

10  Similarly, we can open the file using openFileInput() passing the parameter as the File Name.  One thing, that we need to remember is, give that an an extension to file name Internal Storage...(2)

11 Internal Storage Example

12  Every Android-compatible device supports a shared "external storage" that you can use to save files.  This can be a removable storage media (such as an SD card) or an internal (non-removable) storage.  Files saved to the external storage are world-readable and can be modified by the user when they enable USB mass storage to transfer files on a computer. External Storage

13 External Storage Example

14 SQLite Relational Database 1) Structured data can be saved in an SQLite database 2) Android provides built-in support for SQLite ( 3) All class and interfaces are in android.database.sqlite package 4) Database files are local to the app 5) To share structured data with other apps, consider creating a custom Content provider

15 SQLite Database Example

16