For the Android Programming Seminar conducted at MinSCAT Main Campus, Multimedia Room, February 18th 2019
I presented this when I'm in an student internship exchange program
8. FABRIKAM
ANDROID STUDIO
h t t p s : / / d e v e l o p e r . a n d r o i d . c o m / s t u d i o /
Recommended System Requirements:
• Microsoft® Windows® 7/8/10 (32 or 64-bit)
• 3 GB RAM minimum, 8 GB RAM recommended; plus 1
GB for the Android Emulator
• 2 GB of available disk space minimum,
4 GB Recommended (500 MB for IDE + 1.5 GB for
Android SDK and emulator system image)
• 1280 x 800 minimum screen resolution
Storage Needed:
• IDE: 1.5 GB (948 MB download for installation file)
• Standard Development Kits (SDKs): +-150 MB each
• SDK 21-28 (Lollipop-Pie): 1 GB
• Emulator (optional): 561 MB
• Total: ~3 GB
8
9. FABRIKAM 9
For reference…
My laptop
• Intel Core i5 7200U dual-core 2.50 GHz
• DDR4 8 GB RAM
• 250 GB SSD
Software
• Android Studio
• Vysor
10. FABRIKAM
PROJECT STRUCTURE
• java
• Contains codes of java classes for the algorithms
• You may create your own packages inside
• res
• Contains xml files to represent activity layouts,
drawable, and variables
F o l d e r h i e r a r c h y
10
11. FABRIKAM 11
XML
XML stands for eXtensible Markup Language
XML is a markup language much like HTML
XML was designed to store and transport data
XML was designed to be self-descriptive
13. FABRIKAMFABRIKAM
SQLite vs MySQL
S Q L i t e
• Open-source
• Supported data type:
• BLOB, NULL, INTEGER, TEXT
• Server-less
• File-based, makes it very portable
M y S Q L
• Was open-source, before acquired by Oracle. Open-source
version is MariaDB
• Supported data type:
• NUMERIC, DATE, DATETIME, TIMESTAMP, BLOB, TEXT,
TINYBLOB, MEDIUMBLOB, CHAR, VARCHAR, TINYINT,
SMALLINT, INT, FLOAT, DOUBLE, LONGBLOB, REAL, ENUM, etc.
• More powerful and higher performance
• Security features built-in
• User management capabilities
13
14. FABRIKAM 14
SQLite in Android
Built-in
• The android.database and android.database.sqlite packages offer a higher-performance alternative
where source compatibility is not an issue.
• Single-file database.
Lightweight -> High performance
Secure
• Android-databases created in Android are visible only to the application that created them
Self-contained, serverless, zero-configuration, transactional
Easy to use
W h y ? W h a t f o r ?
15. FABRIKAM 15
When to use SQLite
Your app is fully offline
Storing local app preferences, e.g.
• recently used emoji as in WhatsApp, and
• app theme/appearance
Storing data that your users might prefer to not be stored online
Storing cache data for certain situations e.g. when your app can’t connect to the internet
16. FABRIKAM 16
When NOT to use SQLite
The data you’re storing is larger and more complicated
The data you’re storing is something your users might prefer to be synced
across devices
18. FABRIKAM
DATA MANIPULATION
• Constructor (instantiates the OpenHelper
object)
• open
• close
• getAll
• get
• insert
• update
• delete
• An inner class to hold the return value
C l a s s m e t h o d s
18
27. FABRIKAM 27
The data collection changes on runtime based on user interaction
or network events
28. FABRIKAM 28
What you need to build a RecyclerView
A <RecyclerView/> in the layout xml
An xml file that defines the layout of a RecyclerView row
A LayoutManager object
• LinearLayoutManager
• GridLayoutManager
• StaggeredGridLayoutManager
An Adapter, which is a subclass of RecyclerView.Adapter
A List/ArrayList of data (objects) to show in the RecyclerView
36. FABRIKAM 36
Project source codes are available here
•github.com/HibikiKagenui/Seminar_SQLite
SQLite
•github.com/HibikiKagenui/Seminar_RecyclerView
RecyclerView
37. FABRIKAM 37
What you should learn next
UI
• Buttons (OnClickListener, etc.)
• EditText
Activity
• Activity Lifecycle
• Moving to another Acitivity
• Passing values from one activity to another
View Styles
• styles.xml
• Using the official Material Design library (https://material.io/develop/android/docs/getting-started/)
Consuming Web Service / Web API
• Retrofit
38. FABRIKAM 38
Where you can learn more
YouTube
Udemy
Udacity
Tutorialspoint.com
Official Android documentation (https://developer.android.com/docs/)
Stackoverflow.com
39. FABRIKAM
THANK YOU
M U H A M M A D N A B I L L A H
F I H I R A R I S C H A
+ 6 2 8 1 3 2 2 7 8 1 6 5 8
( W H AT S A P P )
M U H A M M A D. A B E L @
S T U D E N T. U P I . E D U
Editor's Notes
Self-contained: no dependency, can run anywhere
Serverless: the app interacts with the database directly without using some sort of protocol to talk with the server controlling it
Zero-config: It just works; runs. No installation, setup, server start, server stop, etc.
Transactional: Queries are ACID (Atomic, Consistent, Isolated, Durable)
Optimized memory usage
Amount of data in-memory: [amount visible on-screen] + 4