Android: Data Storage

Size: px
Start display at page:

Download "Android: Data Storage"

Transcription

1 Android: Data Storage F. Mallet Université Nice Sophia Antipolis

2 Outline Data Storage Shared Preferences Internal Storage External Storage SQLite Databases Network Connection F. Mallet 2

3 Shared Preferences SharedPreferences gives a framework To save and retrieve persistent key-value pairs Only for primitive data types: boolean, floats, ints, longs, strings Will persist across sessions even if the application is killed API getpreferences(int mode) Only one preference file for one activity MODE_PRIVATE: all the applications sharing the same user ID MODE_WORLD_READABLE: deprecated in API 17 => ContentProvider MODE_WORLD_WRITABLE: deprecated in API 17 => ContentProvider getsharedpreferences(string name, int mode) Multiple preferences files for one activity or shared among activities F. Mallet 3

4 Shared Preferences SharedPreferences gives a framework To save and retrieve persistent key-value pairs Only for primitive data types: boolean, floats, ints, longs, strings Will persist across sessions even if the application is killed API getpreferences(int mode) Calls getsharedpreferences( application name, mode); getsharedpreferences(string name, int mode) Multiple preferences files for one activity or shared among activities If it does not exist, will be created F. Mallet 4

5 Reading values from a key boolean contains(string key) Map<String,?> getall() boolean getboolean(string key, boolean defvalue) float getfloat(string key, float defvalue) int getint(string key, int defvalue) long getlong(string key, long defvalue) String getstring(string key, String defvalue) Writing values SharedPreferences.Editor edit() Atomic changes to be committed SharedPreferences F. Mallet 5

6 Atomic changes to preferences void apply() boolean commit() SharedPreferences.Editor SharedPreferences.Editor clear() SharedPreferences.Editor remove(string key) SharedPreferences.Editor putboolean(string key, boolean value) SharedPreferences.Editor putfloat(string key, float value) SharedPreferences.Editor putint(string key, int value) SharedPreferences.Editor putlong(string key, long value) SharedPreferences.Editor putstring(string key, String value) F. Mallet 6

7 Internal Storage Open or create a file private to an application Removed when the application is uninstalled Class android.content.context FileOutputStream openfileoutput (String name, int mode) MODE_PRIVATE (Default) MODE_APPEND MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE FileInputStream openfileinput (String name) String[] filelist () boolean deletefile (String name) File getfilesdir () File getdir (String name, int mode) (creates if does not exist) File getcachedir () F. Mallet 7

8 Same as standard JDK Use BufferedInputStream with FileInputStream Use FileReader for flows of characters Use BufferedOutputStream with FileOutputStream Use FileWriter for flows of characters Use File: (mkdirs(), exists(), ) Do not forget to close the streams Example: String FILENAME = "hello_file"; String string = "hello world!"; FileOutputStream fos = openfileoutput(filename, Context.MODE_PRIVATE); fos.write(string.getbytes()); fos.close(); Package java.io F. Mallet 8

9 External Storage Removable storage media (SD card) or internal storage Data are world_readable Accessible through USB mass storage Need permissions From Android 4.4 (API 18) Permissions are not required to access private directories Read only <manifest...> <uses-permission android:name="android.permission.read_external_storage" />... </manifest> Write (and read) <manifest...> <uses-permission android:name="android.permission.write_external_storage" />... </manifest> F. Mallet 9

10 Checking media availability Check Read Access public boolean isexternalstoragereadable() { String state = Environment.getExternalStorageState(); return (Environment.MEDIA_MOUNTED.equals(state) Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)); Check Write Access public boolean isexternalstoragewritable() { String state = Environment.getExternalStorageState(); return (Environment.MEDIA_MOUNTED.equals(state); F. Mallet 10

11 class android.content.environment Public shared directory: File getexternalstoragepublicdirectory (String type) Private external directory: File getexternalfilesdir (String type) Types External Directories String DIRECTORY_ALARMS Standard directory for any audio files that should be in the list of alarms that the user can select (not as regular music). String DIRECTORY_DCIM Pictures and videos when mounting the device as a camera. String DIRECTORY_DOCUMENTS Documents created by the user. String DIRECTORY_DOWNLOADS files downloaded by the user. F. Mallet 11

12 More Types External Directories String DIRECTORY_MOVIES movies available to the user. String DIRECTORY_MUSIC Any audio files in the regular list of music for the user. String DIRECTORY_NOTIFICATIONS Any audio files in the list of notifications that the user can select (not as regular music). String DIRECTORY_PICTURES Pictures available to the user. String DIRECTORY_PODCASTS Qny audio files in the list of podcasts that the user can select (not as regular music). String DIRECTORY_RINGTONES Any audio files in the list of ringtones that the user can select (not as regular music). F. Mallet 12

13 Using DataBases Extend an helper class: SQLiteOpenHelper Use its oncreate method to create tables Call SQLiteDatabase getwritabledatabase() to get write access Call SQLiteDatabase getreadabledatabase() to get read access Use the query() method of SQLiteDatabase Example: public class DictionaryOpenHelper extends SQLiteOpenHelper { private static final String DICTIONARY_TABLE_NAME = "dictionary"; private static final String DICTIONARY_TABLE_CREATE = "CREATE TABLE " + DICTIONARY_TABLE_NAME + " (" + KEY_WORD + " TEXT, " + KEY_DEFINITION + " TEXT);"; DictionaryOpenHelper(Context context) { super(context, DATABASE_NAME, null, 1 /* version public void oncreate(sqlitedatabase db) { db.execsql(dictionary_table_create); F. Mallet 13

14 Schema and Contract Schema: declaration of how the database is organized Contract class: (recommended) Companion class to reflect the schema (CONSTANTS) Global definitions, Inner classes for each table Inherit from BaseColums to get an _ID (used by Cursor) Example: public final class ExampleContract { public static final String DATABASE_NAME = exampledb"; private ExampleContract() { /* NOBODY CAN INSTANTIATE */ public static abstract class ExampleEntry implements BaseColumns { public static final String TABLE_NAME = mytable"; public static final String COLUMN_NAME_CATEGORY = category"; public static final String COLUMN_NAME_WORD = word"; public static final String SQL_CREATE = "CREATE TABLE " + TABLE_NAME + "( " + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_NAME_CATEGORY + " TEXT, " + COLUMN_NAME_WORD + " TEXT);"; F. Mallet.. 14

15 Using DataBases Extend an helper class: SQLiteOpenHelper Example: public class DictionaryOpenHelper extends SQLiteOpenHelper { DictionaryOpenHelper(Context context) { super(context, ExampleContract.DATABASE_NAME, null, 1 /* version public void oncreate(sqlitedatabase db) { public void onupgrade(sqlitedatabase db, int oldversion, int newversion) { db.execsql(tablecontract.wordcontract.sql_delete); public void ondowngrade(sqlitedatabase db, int oldversion, int newversion) { onupgrade(db, oldversion, newversion); F. Mallet 15

16 Method insert of SQliteDatabase Use ContentValues Example SQLiteDatabase db = helper.getwritabledatabase(); Adding a row in a table ContentValues values = new ContentValues(); values.put(examplecontract.exampleentry.column_name_category,category); values.put(examplecontract.exampleentry.column_name_word, word); long newrowid = db.insert(examplecontract.exampleentry.table_name, null, // name of columns that can be null values); F. Mallet 16

17 Deleting a row Method insert of SQliteDatabase Make a SQLite query for deletion Example (in Contract) public static final String DELETE_ROW = COLUMN_NAME_WORD + " =?"; Example (to delete the row) SQLiteDatabase db = helper.getwritabledatabase(); int nb = db.delete(examplecontract.exampleentry.table_name, ExampleContract.ExampleEntry.DELETE_ROW, new String[]{word); F. Mallet 17

18 Selecting rows Use Query method in SQLiteDatabase public Cursor query (String table, String[] columns, String selection, String[] selectionargs, String groupby, String having, String orderby) Use the Cursor to iterate through the result Example SQLiteDatabase db = helper.getreadabledatabase(); Cursor c = db.query(examplecontract.exampleentry.table_name, null, null, null, null, null, ExampleContract.ExampleEntry.COLUMN_NAME_CATEGORY); List<DBLine> mylist = new ArrayList<>(); while (c.movetonext()) { mylist.add(new DBLine(c.getString(1), c.getstring(2))); F. Mallet 18

19 References Android Developers Other lectures at UNS P. Renevier E. Amosse Books Beginning Android, M. L. Murphy, APress Android Programming: The Big Nerd Ranch Guide, B. Phillips, B. Hardy, F. Mallet 19

CS378 -Mobile Computing. Persistence

CS378 -Mobile Computing. Persistence 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 to reclaim resources but may be recreated later 2 Storing

More information

CS371m - Mobile Computing. Persistence

CS371m - Mobile Computing. Persistence CS371m - Mobile Computing Persistence Storing Data Multiple options for storing data associated with apps Shared Preferences Internal Storage device memory External Storage SQLite Database Network Connection

More information

MOBILE APPLICATIONS PROGRAMMING

MOBILE APPLICATIONS PROGRAMMING Data Storage 23.12.2015 MOBILE APPLICATIONS PROGRAMMING Krzysztof Pawłowski Polsko-Japońska Akademia Technik Komputerowych STORAGE OPTIONS Shared Preferences SQLite Database Internal Storage External Storage

More information

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

Eng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza. Data persistence Eng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza Data persistence Shared preferences A method to store primitive data in android as key-value pairs, these saved data will

More information

07. Data Storage

07. Data Storage 07. Data Storage 22.03.2018 1 Agenda Data storage options How to store data in key-value pairs How to store structured data in a relational database 2 Data Storage Options Shared Preferences Store private

More information

Mobile and Ubiquitous Computing: Android Programming (part 4)

Mobile and Ubiquitous Computing: Android Programming (part 4) Mobile and Ubiquitous Computing: Android Programming (part 4) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si Examples from: Mobile and Ubiquitous Computing Jo Vermeulen,

More information

CSCU9YH: Development with Android

CSCU9YH: Development with Android : Development with Android Computing Science and Mathematics University of Stirling Data Storage and Exchange 1 Preferences: Data Storage Options a lightweight mechanism to store and retrieve keyvalue

More information

The Basis of Data. Steven R. Bagley

The Basis of Data. Steven R. Bagley The Basis of Data Steven R. Bagley So far How to create a UI View defined in XML Java-based Activity as the Controller Services Long running processes Intents used to send messages between things asynchronously

More information

SQLite Database. References. Overview. Structured Databases

SQLite Database. References. Overview. Structured Databases SQLite Database References Android Developers Article https://developer.android.com/training/basics/data-storage/databases.html Android SQLite Package Reference https://developer.android.com/reference/android/database/sqlite/package-summary.html

More information

Spring Lecture 5 Lecturer: Omid Jafarinezhad

Spring Lecture 5 Lecturer: Omid Jafarinezhad Mobile Programming Sharif University of Technology Spring 2016 - Lecture 5 Lecturer: Omid Jafarinezhad Storage Options Android provides several options for you to save persistent application data. The

More information

How-to s and presentations. Be prepared to demo them in class. https://sites.google.com/site/androidhowto/presentati ons

How-to s and presentations. Be prepared to demo them in class. https://sites.google.com/site/androidhowto/presentati ons Upcoming Assignments Readings: Chapter 6 by today Lab 3 due today (complete survey) Lab 4 will be available Friday (due February 5) Friday Quiz in Blackboard 2:10-3pm (Furlough) Vertical Prototype due

More information

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

SharedPreference. <map> <int name=access_count value=3 /> </map> 1 Android Data Storage Options Android provides several data storage options for you to save persistent application data depends on your specific needs: private/public, small/large datasets :- Internal

More information

SharedPreferences Internal Storage External Storage SQLite databases

SharedPreferences Internal Storage External Storage SQLite databases SharedPreferences Internal Storage External Storage SQLite databases Use when you want to store small amounts of primitive data A persistent map that holds key-value pairs of simple data types Automatically

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 3 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 2 - recap Views and Layouts Events Basic application components Activities Intents 9/15/2014

More information

How to access your database from the development environment. Marco Ronchetti Università degli Studi di Trento

How to access your database from the development environment. Marco Ronchetti Università degli Studi di Trento 1 How to access your database from the development environment Marco Ronchetti Università degli Studi di Trento App (data) management LONG LONG App management Data management 2 3 Open the DDMS Perspective

More information

Data storage and exchange in Android

Data storage and exchange in Android Mobile App Development 1 Overview 2 3 SQLite Overview Implementation 4 Overview Methods to implement URI like SQL 5 Internal storage External storage Overview 1 Overview 2 3 SQLite Overview Implementation

More information

Single Application Persistent Data Storage. CS 282 Principles of Operating Systems II Systems Programming for Android

Single Application Persistent Data Storage. CS 282 Principles of Operating Systems II Systems Programming for Android Single Application Persistent Data Storage CS 282 Principles of Operating Systems II Systems Programming for Android Android offers several ways to store data Files SQLite database SharedPreferences Android

More information

Database Development In Android Applications

Database Development In Android Applications ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture Database Development In Android Applications 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan & Imran

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 3 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 2 -recap Views and Layouts Events Basic application components Activities Intents BroadcastReceivers

More information

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

SQLite. 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 6: Working with Databases. What is a Database Server. Advantages of SQLite SQLite 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 6: Working with Databases Dr Dimitris C. Dracopoulos SQLite is a tiny yet powerful database engine. Besides Android, it can be found in: Apple iphone

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 3 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 2 - recap Views and Layouts Events Basic application components Activities Intents 9/22/2017

More information

Mobile Computing Practice # 2d Android Applications Local DB

Mobile Computing Practice # 2d Android Applications Local DB Mobile Computing Practice # 2d Android Applications Local DB In this installment we will add persistent storage to the restaurants application. For that, we will create a database with a table for holding

More information

Mobile Application Programing: Android. Data Persistence

Mobile Application Programing: Android. Data Persistence Mobile Application Programing: Android Data Persistence Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another

More information

SAVING SIMPLE APPLICATION DATA

SAVING SIMPLE APPLICATION DATA 1 DATA PERSISTENCE OBJECTIVES In this chapter, you will learn how to persist data in your Android applications. Persisting data is an important topic in application development, as users typically expect

More information

Mr. Pritesh N. Patel Assistant Professor MCA ISTAR, V. V. Nagar ANDROID DATABASE TUTORIAL

Mr. Pritesh N. Patel Assistant Professor MCA ISTAR, V. V. Nagar ANDROID DATABASE TUTORIAL Mr. Pritesh N. Patel Assistant Professor MCA ISTAR, V. V. Nagar ANDROID DATABASE TUTORIAL Mr. Pritesh N. Patel 1 Storage Options Android provides several options for you to save persistent application

More information

Android Programming Lecture 16 11/4/2011

Android Programming Lecture 16 11/4/2011 Android Programming Lecture 16 11/4/2011 New Assignment Discuss New Assignment for CityApp GetGPS Search Web Service Parse List Coordinates Questions from last class It does not appear that SQLite, in

More information

An Android Studio SQLite Database Tutorial

An Android Studio SQLite Database Tutorial An Android Studio SQLite Database Tutorial Previous Table of Contents Next An Android Studio TableLayout and TableRow Tutorial Understanding Android Content Providers in Android Studio Purchase the fully

More information

Android File & Storage

Android File & Storage Files Lecture 9 Android File & Storage Android can read/write files from two locations: Internal (built into the device) and external (an SD card or other drive attached to device) storage Both are persistent

More information

Android Database Programming

Android Database Programming Android Database Programming Exploit the power of data-centric and data-driven Android applications with this practical tutorial Jason Wei BIRMINGHAM - MUMBAI Android Database Programming Copyright 2012

More information

Atmiya Institute of Technology & Science, Rajkot Department of MCA

Atmiya Institute of Technology & Science, Rajkot Department of MCA Atmiya Institute of Technology & Science, Rajkot Department of MCA Chapter 10 Application Preference (/data/data//shared_prefs/.xml) Private Preference (Data sharing

More information

Automatically persisted among application sessions

Automatically persisted among application sessions STORAGE OPTIONS Storage options SharedPreference Small amount of data, as Key-value pairs Private to an Activity or Shared among Activities Internal storage Small to medium amount of data Private to the

More information

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

Android Components. Android Smartphone Programming. Matthias Keil. University of Freiburg Android Components Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 3. November 2014 Outline 1 Data Storage 2 Messages to the User 3 Background Work 4

More information

Mobile Programming Lecture 10. ContentProviders

Mobile Programming Lecture 10. ContentProviders Mobile Programming Lecture 10 ContentProviders Lecture 9 Review In creating a bound service, why would you choose to use a Messenger over extending Binder? What are the differences between using GPS provider

More information

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

Android Components Android Smartphone Programming. Outline University of Freiburg. Data Storage Database University of Freiburg. Notizen. Android Components Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 4. November 2013 Outline 1 2 Messages to the User 3 Background Work 4 App Widgets 5

More information

How to access your database from the development environment. Marco Ronchetti Università degli Studi di Trento

How to access your database from the development environment. Marco Ronchetti Università degli Studi di Trento 1 How to access your database from the development environment Marco Ronchetti Università degli Studi di Trento App (data) management LONG LONG App management Data management 2 3 Open the DDMS Perspective

More information

Mediensystemen mit Android

Mediensystemen mit Android LFE Medieninformatik i ik Prof. Dr. Heinrich i Hußmann (Dozent), Alexander De Luca, Gregor Broll, Max-Emanuel Maurer (supervisors) Praktikum Entwicklung von Mediensystemen mit Android Storing, Retrieving

More information

Object-Oriented Databases Object-Relational Mappings and Frameworks. Alexandre de Spindler Department of Computer Science

Object-Oriented Databases Object-Relational Mappings and Frameworks. Alexandre de Spindler Department of Computer Science Object-Oriented Databases Object-Relational Mappings and Frameworks Challenges Development of software that runs on smart phones. Data needs to outlive program execution Use of sensors Integration with

More information

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

Content Provider. Introduction 01/03/2016. Session objectives. Content providers. Android programming course. Introduction. Built-in Content Provider Android programming course Session objectives Introduction Built-in Custom By Võ Văn Hải Faculty of Information Technologies 2 Content providers Introduction Content providers manage access to a structured

More information

Basic UI elements: Defining Activity UI in the code. Marco Ronchetti Università degli Studi di Trento

Basic UI elements: Defining Activity UI in the code. Marco Ronchetti Università degli Studi di Trento 1 Basic UI elements: Defining Activity UI in the code Marco Ronchetti Università degli Studi di Trento UI Programmatically public class UIThroughCode extends Activity { LinearLayout llayout; TextView tview;

More information

Managing Data. However, we'll be looking at two other forms of persistence today: (shared) preferences, and databases.

Managing Data. However, we'll be looking at two other forms of persistence today: (shared) preferences, and databases. Managing Data This week, we'll be looking at managing information. There are actually many ways to store information for later retrieval. In fact, feel free to take a look at the Android Developer pages:

More information

Persisting Data Making a Preference Screen

Persisting Data Making a Preference Screen Chapter 5 Persisting Data Even in the midst of grand architectures designed to shift as much user data into the cloud as possible, the transient nature of mobile applications will always require that at

More information

Data Storage Methods in Android

Data Storage Methods in Android Data Storage Methods in Android Data Storage Applica4ons o5en need to use some type of data storage for persistent data. The Android framework offers different data storage op4ons: Shared preferences:

More information

EMBEDDED SYSTEMS PROGRAMMING SQLite

EMBEDDED SYSTEMS PROGRAMMING SQLite EMBEDDED SYSTEMS PROGRAMMING 2017-18 SQLite DATA STORAGE: ANDROID Shared Preferences Filesystem: internal storage Filesystem: external storage SQLite (Also available in ios and WP) Network (e.g., Google

More information

MyDatabaseHelper. public static final String TABLE_NAME = "tbl_bio";

MyDatabaseHelper. public static final String TABLE_NAME = tbl_bio; Page 1 of 5 MyDatabaseHelper import android.content.context; import android.database.sqlite.sqliteopenhelper; class MyDatabaseHelper extends SQLiteOpenHelper { private static final String DB_NAME = "friend_db";

More information

Data storage overview SQLite databases

Data storage overview SQLite databases http://www.android.com/ Data storage overview SQLite databases Data storage overview Assets (assets) and Resources (res/raw) Private data installed with the application (read-only) Use the android.content.res.xxx

More information

CS371m - Mobile Computing. Persistence - SQLite

CS371m - Mobile Computing. Persistence - SQLite CS371m - Mobile Computing Persistence - SQLite In case you have not taken 347: Data Management or worked with databases as part of a job, internship, or project: 2 Databases RDBMS relational data base

More information

Data Persistence. Chapter 10

Data Persistence. Chapter 10 Chapter 10 Data Persistence When applications create or capture data from user inputs, those data will only be available during the lifetime of the application. You only have access to that data as long

More information

Software Engineering Large Practical: Preferences, storage, and testing

Software Engineering Large Practical: Preferences, storage, and testing Software Engineering Large Practical: Preferences, storage, and testing Stephen Gilmore (Stephen.Gilmore@ed.ac.uk) School of Informatics November 9, 2016 Contents A simple counter activity Preferences

More information

Required Core Java for Android application development

Required Core Java for Android application development Required Core Java for Android application development Introduction to Java Datatypes primitive data types non-primitive data types Variable declaration Operators Control flow statements Arrays and Enhanced

More information

Android Application Development Course 28 Contact Hours

Android Application Development Course 28 Contact Hours Android Application Development Course 28 Contact Hours Course Overview This course that provides the required knowledge and skills to design and build a complete Androidâ application. It delivers an extensive

More information

LẬP TRÌNH DI ĐỘNG. Bài 9: Lưu Trữ & SQLite

LẬP TRÌNH DI ĐỘNG. Bài 9: Lưu Trữ & SQLite LẬP TRÌNH DI ĐỘNG Bài 9: Lưu Trữ & SQLite Nhắc lại bài trước Intent, intent service & intent filter Intent tường minh & intent ngầm định Các thành phần của intent: component, action, category, data, type,

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Core Java Contents. Duration: 25 Hours (1 Month)

Core Java Contents. Duration: 25 Hours (1 Month) Duration: 25 Hours (1 Month) Core Java Contents Java Introduction Java Versions Java Features Downloading and Installing Java Setup Java Environment Developing a Java Application at command prompt Java

More information

JAVA. Duration: 2 Months

JAVA. Duration: 2 Months JAVA Introduction to JAVA History of Java Working of Java Features of Java Download and install JDK JDK tools- javac, java, appletviewer Set path and how to run Java Program in Command Prompt JVM Byte

More information

Lab 5 Periodic Task Scheduling

Lab 5 Periodic Task Scheduling Lab 5 Periodic Task Scheduling Scheduling a periodic task in Android is difficult as it goes against the philosophy of keeping an application active only while the user is interacting with it. You are

More information

Files and IO, Streams. JAVA Standard Edition

Files and IO, Streams. JAVA Standard Edition Files and IO, Streams JAVA Standard Edition Java - Files and I/O The java.io package contains nearly every class you might ever need to perform input and output (I/O) in Java. All these streams represent

More information

Android Camera. Alexander Nelson October 6, University of Arkansas - Department of Computer Science and Computer Engineering

Android Camera. Alexander Nelson October 6, University of Arkansas - Department of Computer Science and Computer Engineering Android Camera Alexander Nelson October 6, 2017 University of Arkansas - Department of Computer Science and Computer Engineering Why use the camera? Why not? Translate Call Learn Capture How to use the

More information

Debojyoti Jana (Roll ) Rajrupa Ghosh (Roll ) Sreya Sengupta (Roll )

Debojyoti Jana (Roll ) Rajrupa Ghosh (Roll ) Sreya Sengupta (Roll ) DINABANDHU ANDREWS INSTITUTE OF TECHNOLOGY AND MANAGEMENT (Affiliated to West Bengal University of Technology also known as Maulana Abul Kalam Azad University Of Technology) Project report on ANDROID QUIZ

More information

CS371m - Mobile Computing. Content Providers And Content Resolvers

CS371m - Mobile Computing. Content Providers And Content Resolvers CS371m - Mobile Computing Content Providers And Content Resolvers Content Providers One of the four primary application components: activities content providers / content resolvers services broadcast receivers

More information

Programming in Android. Nick Bopp

Programming in Android. Nick Bopp Programming in Android Nick Bopp nbopp@usc.edu Types of Classes Activity This is the main Android class that you will be using. These are actively displayed on the screen and allow for user interaction.

More information

App Development for Smart Devices. Lec #5: Content Provider

App Development for Smart Devices. Lec #5: Content Provider App Development for Smart Devices CS 495/595 - Fall 2011 Lec #5: Content Provider Tamer Nadeem Dept. of Computer Science Some slides adapted from Jussi Pohjolainen and Bob Kinney Objective Data Storage

More information

Basic I/O - Stream. Java.io (stream based IO) Java.nio(Buffer and channel-based IO)

Basic I/O - Stream. Java.io (stream based IO) Java.nio(Buffer and channel-based IO) I/O and Scannar Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283 I/O operations Three steps:

More information

CS378 -Mobile Computing. Persistence -SQLite

CS378 -Mobile Computing. Persistence -SQLite 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

More information

Android Application Development

Android Application Development Android Application Development Octav Chipara What is Android A free, open source mobile platform A Linux-based, multiprocess, multithreaded OS Android is not a device or a product It s not even limited

More information

CS Android. Vitaly Shmatikov

CS Android. Vitaly Shmatikov CS 5450 Android Vitaly Shmatikov Structure of Android Applications Applications include multiple components Activities: user interface Services: background processing Content providers: data storage Broadcast

More information

Andorid Storage Options

Andorid Storage Options CPET 565 Mobile Computing Systems CPET/ITC 499 Mobile Computing File Storage, Shared Preferences, and SQLite Database Reference Android Programming Concepts, by Trish Cornez and Richard Cornez, pubslihed

More information

Writing Efficient Drive Apps for Android. Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations

Writing Efficient Drive Apps for Android. Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations Writing Efficient Drive Apps for Android Claudio Cherubino / Alain Vongsouvanh Google Drive Developer Relations Raise your hand if you use Google Drive source: "put your hands up!" (CC-BY) Raise the other

More information

How to access your database from the development environment. Marco Ronchetti Università degli Studi di Trento

How to access your database from the development environment. Marco Ronchetti Università degli Studi di Trento 1 How to access your database from the development environment Marco Ronchetti Università degli Studi di Trento App (data) management LONG LONG App management Data management 2 3 Open the DDMS Perspective

More information

Lecture 2 Android SDK

Lecture 2 Android SDK Lecture 2 Android SDK This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a

More information

Andrid prgramming curse Data strage Sessin bjectives Internal Strage Intrductin By Võ Văn Hải Faculty f Infrmatin Technlgies Andrid prvides several ptins fr yu t save persistent applicatin data. The slutin

More information

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

CS 4518 Mobile and Ubiquitous Computing Lecture 6: Databases, Camera, Face Detection Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 6: Databases, Camera, Face Detection Emmanuel Agu Administrivia Project 2 Emailed out last week Should be done in groups of 5 or 6 Due this Thursday, 11.59PM

More information

Tirgul 1. Course Guidelines. Packages. Special requests. Inner classes. Inner classes - Example & Syntax

Tirgul 1. Course Guidelines. Packages. Special requests. Inner classes. Inner classes - Example & Syntax Tirgul 1 Today s topics: Course s details and guidelines. Java reminders and additions: Packages Inner classes Command Line rguments Primitive and Reference Data Types Guidelines and overview of exercise

More information

PIC 20A Streams and I/O

PIC 20A Streams and I/O PIC 20A Streams and I/O Ernest Ryu UCLA Mathematics Last edited: December 7, 2017 Why streams? Often, you want to do I/O without paying attention to where you are reading from or writing to. You can read

More information

Chapter 10. IO Streams

Chapter 10. IO Streams Chapter 10 IO Streams Java I/O The Basics Java I/O is based around the concept of a stream Ordered sequence of information (bytes) coming from a source, or going to a sink Simplest stream reads/writes

More information

DEVELOPMENT OF PUBLIC FACILITY AND HOUSEHOLD LOCATOR TOOL USING MOBILE GIS AND ANDROID TECHNOLOGY

DEVELOPMENT OF PUBLIC FACILITY AND HOUSEHOLD LOCATOR TOOL USING MOBILE GIS AND ANDROID TECHNOLOGY DEVELOPMENT OF PUBLIC FACILITY AND HOUSEHOLD LOCATOR TOOL USING MOBILE GIS AND ANDROID TECHNOLOGY Engr. Alexander T. Demetillo, Engr. Michelle V. Japitana, Sonny S. Norca CLAIMS-GIS Project, College of

More information

File Operations in Java. File handling in java enables to read data from and write data to files

File Operations in Java. File handling in java enables to read data from and write data to files Description Java Basics File Operations in Java File handling in java enables to read data from and write data to files along with other file manipulation tasks. File operations are present in java.io

More information

Data Structures. 03 Streams & File I/O

Data Structures. 03 Streams & File I/O David Drohan Data Structures 03 Streams & File I/O JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN 0132162709 2012 Pearson Education, Inc., Upper Saddle River, NJ.

More information

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

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie Android Persistence," Multithreading &

More information

JAVA. 1. Introduction to JAVA

JAVA. 1. Introduction to JAVA JAVA 1. Introduction to JAVA History of Java Difference between Java and other programming languages. Features of Java Working of Java Language Fundamentals o Tokens o Identifiers o Literals o Keywords

More information

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline ::

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline :: Module Title Duration : Intro to JAVA SE7 and Programming using JAVA SE7 : 9 days Course Description The Java SE 7 Fundamentals course was designed to enable students with little or no programming experience

More information

Complete Java Contents

Complete Java Contents Complete Java Contents Duration: 60 Hours (2.5 Months) Core Java (Duration: 25 Hours (1 Month)) Java Introduction Java Versions Java Features Downloading and Installing Java Setup Java Environment Developing

More information

Android Application Model II. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr.

Android Application Model II. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Android Application Model II CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath 1 Outline Activity Lifecycle Services Persistence Content

More information

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7)

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7) Software Development & Education Center Java Platform, Standard Edition 7 (JSE 7) Detailed Curriculum Getting Started What Is the Java Technology? Primary Goals of the Java Technology The Java Virtual

More information

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1

CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 P a g e 1 CS506 Web Programming and Development Solved Subjective Questions With Reference For Final Term Lecture No 1 Q1 Describe some Characteristics/Advantages of Java Language? (P#12, 13, 14) 1. Java

More information

Software Engineering Large Practical: Storage, Settings and Layouts. Stephen Gilmore School of Informatics October 27, 2017

Software Engineering Large Practical: Storage, Settings and Layouts. Stephen Gilmore School of Informatics October 27, 2017 Software Engineering Large Practical: Storage, Settings and Layouts Stephen Gilmore School of Informatics October 27, 2017 Contents 1. Storing information 2. Settings 3. Layouts 1 Storing information Storage

More information

CMSC436: Fall 2013 Week 4 Lab

CMSC436: Fall 2013 Week 4 Lab CMSC436: Fall 2013 Week 4 Lab Objectives: Familiarize yourself with Android Permission and with the Fragment class. Create simple applications using different Permissions and Fragments. Once you ve completed

More information

In-app Billing Version 3

In-app Billing Version 3 13 In-app Billing Version 3 Bruno Oliveira Developer Relations, Android 13 In-app billing! 2 In-app billing! Implement ALL the billing! 2 In-app billing! DO NOT WANT 2 PREVIOUSLY IN IN-APP BILLING 3 Easy

More information

PES INSTITUTE OF TECHNOLOGY (BSC) IV MCA, Second IA Test, May 2017 Mobile Applications (13MCA456) Solution Set Faculty: Jeny Jijo

PES INSTITUTE OF TECHNOLOGY (BSC) IV MCA, Second IA Test, May 2017 Mobile Applications (13MCA456) Solution Set Faculty: Jeny Jijo PES INSTITUTE OF TECHNOLOGY (BSC) IV MCA, Second IA Test, May 2017 Mobile Applications (13MCA456) Solution Set Faculty: Jeny Jijo 1) Explain the techniques to handle changes in screen orientation in Android

More information

Lecture 22. Java Input/Output (I/O) Streams. Dr. Martin O Connor CA166

Lecture 22. Java Input/Output (I/O) Streams. Dr. Martin O Connor CA166 Lecture 22 Java Input/Output (I/O) Streams Dr. Martin O Connor CA166 www.computing.dcu.ie/~moconnor Topics I/O Streams Writing to a Stream Byte Streams Character Streams Line-Oriented I/O Buffered I/O

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Firebase Realtime Database. Landon Cox April 6, 2017

Firebase Realtime Database. Landon Cox April 6, 2017 Firebase Realtime Database Landon Cox April 6, 2017 Databases so far SQLite (store quiz progress locally) User starts app Check database to see where user was Say you want info about your friends quizzes

More information

Software 1 with Java. Recitation No. 7 (Java IO) May 29,

Software 1 with Java. Recitation No. 7 (Java IO) May 29, Software 1 with Java Recitation No. 7 (Java IO) May 29, 2007 1 The java.io package The java.io package provides: Classes for reading input Classes for writing output Classes for manipulating files Classes

More information

Active Learning: Streams

Active Learning: Streams Lecture 29 Active Learning: Streams The Logger Application 2 1 Goals Using the framework of the Logger application, we are going to explore three ways to read and write data using Java streams: 1. as text

More information

Android. The Toolbar

Android. The Toolbar Android The Toolbar Credits Lectures are heavily based of materials and examples from: Android Programming The Big Nerd Ranch Guides Bill Phillips and Brian Hardy April 7, 2013 ToDoList We re going to

More information

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the

More information

CN208 Introduction to Computer Programming

CN208 Introduction to Computer Programming CN208 Introduction to Computer Programming Lecture #11 Streams (Continued) Pimarn Apipattanamontre Email: pimarn@pimarn.com 1 The Object Class The Object class is the direct or indirect superclass of every

More information

Understanding Application

Understanding Application Introduction to Android Application Development, Android Essentials, Fifth Edition Chapter 4 Understanding Application Components Chapter 4 Overview Master important terminology Learn what the application

More information

Android Programming - Jelly Bean

Android Programming - Jelly Bean 1800 ULEARN (853 276) www.ddls.com.au Android Programming - Jelly Bean Length 5 days Price $4235.00 (inc GST) Overview This intensive, hands-on five-day course teaches programmers how to develop activities,

More information

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Fragments, Camera Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Fragments, Camera Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 4a: Fragments, Camera Emmanuel Agu Fragments Recall: Fragments Sub-components of an Activity (screen) An activity can contain multiple fragments, organized

More information

Java 5 New Language Features

Java 5 New Language Features Java 5 New Language Features Ing. Jeroen Boydens, BLIN prof dr. ir. Eric Steegmans http://users.khbo.be/peuteman/java5/ Enterprise Programming Last session. Jeroen Boydens 1. JDK v1.4: assert 2. Generics

More information