LAST - Sheet1 Flashcards
Mobile operating system based on Linux
Android
Originally developed by Android Inc.
Android
Google purchased Android Inc. in ___
2005
___ is open and free
Android OS
Open Source
Larger Developer and Community Reach
Increased Marketing
Inter App Integration
Reduced Cost of Development
Higher Success Ratio
Rich Development Environment
Android
Android =
0.7334999999999999
Android Versions and their Names
Cupcake
Donut
Eclair
Froyo
Gingerbread
Honeycomb
Ice Cream Sandwich
Jellybean
KitKat
Lollipop
Marshmallow
Nougat
Oreo
Pie
Android 10
Android 11
Android 12
Both versions are first commercial versions
Android 1.0 and 1.1 (Unnamed)
Officially released publicly in 2008 and 2008
Android 1.0 and 1.1 (Unnamed)
The first android commercial version was placed on ____
HTC dream device.
These versions were released without codename
Android 1.0 and 1.1 (Unnamed)
Google Maps
Camera
Gmail, Contacts and Google Synchronization
Web Browser
Wireless supports - WiFi and Bluetooth
Android 1.0 (alpha);
Add Save attachment in message
Provides reviews and details when user search business on maps
Android 1.1 (beta):
Released in April 2009.
Android 1.5 (CupCake)
The first released codename with official name.
Android 1.5 (CupCake)
It brought features in UI design and update several new features
Android 1.5 (CupCake)
New upload service on Youtube and Picasa like Uploading Videos and Photos
Supporting in MPEG-4, Video recording
Improving Web Browser-Copy and Paste facility
Android 1.5 (CupCake)
Released in Sept 2009
Android 1.6 (Donut)
It supports large screen size
Providing Gallery and Camera features
Improve speed in system apps
Android 1.6 (Donut)
Released in Oct 2009 and 2.1 version released in Dec 2009.
Android 2.0 and 2.1 (Eclair)
Update UI
Support Live Wallpaper
Support Bluetooth 2.1
Improve Google map
Minor API Changes
Android 2.0 and 2.1 (Eclair)
Released in May 2010.
Android 2.2 (Froyo)
Support Animated GIF
WiFI Support Hotspot functionality
Speed improvements
Upload file support in browser
Support numeric and alphanumeric password
Android 2.2 (Froyo)
Released in December 2010
Android 2.3 and 2.4 (Gingerbread)
It was officially announced in Nexus S android phone which is Google co-developed with Samsung
Android 2.3 and 2.4 (Gingerbread)
Improve Copy-Paste Facility
Updated UI design
Social Networking Supports
Easy use of keyboard
Android 2.3 and 2.4 (Gingerbread)
was released in February 2011 quickly followed by 3.1 and 3.2 in July and August, 2011.
Android 3.0, 3.1, and 3.2 (Honeycomb)
____ was released in February 2011
Android 3.0
Gmail App improvements
Updated 3D UI
Media Sync from SD Card
Google eBooks
Google Talk Video Chat
Support Adobe Flash in Browser
High-performance WiFi Connections and Lock
Chinese handwriting
Android 3.0, 3.1, and 3.2 (Honeycomb)
Released in October 2011.
Android 4.0 (Ice-Cream Sandwich)
It was Google’s attempt to synthesize Honeycomb
Android 4.0 (Ice-Cream Sandwich)
Improved text input and spelling check
WiFi direct
Photo Decor facility
Improve in keyboard correction
Face Lock
Improve in video recording resolution
Camera performance
Up to 16 tabs in web browser
Android 4.0 (Ice-Cream Sandwich)
Released in July 2012
Android 4.1, 4.2 and 4.3 (Jelly Bean)
‘Google now’ is the main feature.
Android 4.1, 4.2 and 4.3 (Jelly Bean)
Voice Search
Smooth UI
Improve camera application
Security enhancement
Voice typing
Multiple user accounts on tablet only
4k resolution support
Supporting Bluetooth Low Energy
Bi-directional text and other language support
Support USB audio
Lock screen improvement
Set the volume of incoming calls and showing message alert
Native emoji support
Android 4.1, 4.2 and 4.3 (Jelly Bean)
Released in September 2013
Android 4.4 (Kitkat)
Screen Recording
KitKat adds a feature in ‘Google now’. Its name is ‘OK Google’. “OK Google” allows access google now to the user without touching your mobile phone
GPS Support
Offline music support
UI updates for google map navigation and alarm
Also, introduce Emoji’ to google keyboard
Android 4.4 (Kitkat)
KitKat adds a feature in ‘Google now’. Its name is ____. _____allows access google now to the user without touching your mobile phone
‘OK Google’
Released in November 2014.
Android 5.0 and 5.1 (Lollipop)
Support ART(Android RunTime)
Android 5.0 and 5.1 (Lollipop)
Save battery on some device
Improvement in UI
New material design
Bug fixes
Multiple sim card support
High definition voice call
Android 5.0 and 5.1 (Lollipop)
Released in May 2015
Android 6.0 (Marshmallow)
Fingerprint authentication
USB Type C support
Save battery - ‘Sleep Mode’
App permission model-OPT (send request for permission)
New Emoji’s
Android 6.0 (Marshmallow)
Released in August 2016.
Android 7.0 (Nougat)
It was announced with native split-screen mode and data saver feature.
Android 7.0 (Nougat)
Provide multitasking
Providing multi-window mode
Improve in storage manager
Display touch improvement
Android 7.0 (Nougat)
Released in August 2017.
Android 8.0 (Oreo)
Support PIP(Picture-in-Picture)
Multi-display support
Google Play support
Adaptive Icons
Improve notification system
Android 8.0 (Oreo)
Released in August 2018
Android 9.0 (Pie)
A “screenshot” button has been added
A new “Lockdown” mode for biometrics
Support for display cutouts
Adaptive Batter prediction
Adaptive brightness modifies screen brightness based on user habits
Android 9.0 (Pie)
Released in September 3 2019.
Android 10
Known as “Queen Cake”, internally as Quince Tart
Android 10
New permissions to access location in background and to access photo, video, and audio files
Sharing shortcuts, which allow sharing content with a contact directly
Dynamic depth format for photos, which allow changing background blur after taking a photo
New system-wide dark theme/mode
Android 10
Released in September 8, 2020.
Android 11
Known as “Red Velvet Cake”
Android 11
Native Screen Recording
Muting notifications during video
Increase touch sensitivity
Notification History
Auto-revoke app permissions
Android 11
Released in October 4, 2021.
Android 12
Known as “Snow Cone”
Android 12
Scrolling Screenshots
AppSearch
Improved Auto-Rotate
Easier WiFi Sharing
One-Handed Mode
Rich Content Insertion
Overview Suggestions
Game Mode APIs
Android 12
Released in August 15, 2022
Android 13
Known as “Tiramisu”
Android 13
Improved Security Features
New Reading Mode
Digital Car Keys
Native LE Bluetooth Support
Additional Material You Theme Options
QR Code Scanner Support
Android 13
Released in October 4, 2023
Android 14
Known as “Upside Down Cake”
Android 14
Smarter Scaling and Large Fonts
Notification Flashes
Restrictions for Photo and Video Access
Protected Pin
Data Protection
Regional Preferences
Predictive Back Gestures
Health Connect
Android 14
Released in August 13, 2024.
Android 15
Known as “Vanilla Ice Cream”
Android 15
SQL
Media
Connectivity
Messaging
Mobile Applications
Multi touch
Android Features
A software stack of components to support a mobile device needs
Android Architecture
_______ contains a Linux Kernel, collection of c/c++ libraries which is exposed through an application framework services, runtime and application.
Android software stack
Applications
Android Framework
Android Runtime
Platform Libraries
Linux Kernel
Android software stack
is the main component in android to provide its operating system functions to mobile.
Linux Kernel
which is responsible for running a mobile application
Dalvik Virtual Machine (DVM)
Prerequisites of Android Studio
JDK
Android Studio
lets you carry out a wide range of actions, including running your app and launching Android tools
toolbar
helps you navigate through your project and open files for editing. It provides a more compact view of the structure visible in the Project window
navigation bar
is where you create and modify code. Depending on the current file type, the editor can change. For example, when viewing a layout file, the editor displays the Layout Editor
editor window
runs around the outside of the IDE window and contains the buttons that allow you to expand or collapse individual tool windows
tool window bar
give you access to specific tasks like project management, search, version control, and more. You can expand them and collapse them
tool windows
displays the status of your project and the IDE itself, as well as any warning or messages
status bar
Connect your Android Phone to the computer
Make sure USB Debugging is enabled (you can do this by enabling Developer options first)
Run on real Device
Navigate to Device Manager and select Create Device
Select your screen size and kind of phone
Select Android SDK version
Run on Emulator
are the essential building blocks of an Android application.
Application Components
Application components are loosely coupled by the application manifest file ___that describes each component of the application and how they interact
AndroidManifest.xml
These components are loosely coupled by the application manifest file AndroidManifest.xml that describes each component of the application and how they interact
Application Components
They dictate the UI and handle the user interaction to the smart phone screen
Activities
They handle background processing associated with an application
Services
They handle communication between Android OS and applications
Broadcast Receivers
They handle data and database management issues
Content Providers
An _____ represents a single screen with a user interface, in-short ____ performs actions on the screen.
Activity
An activity is implemented as a subclass of Activity class as follows –
public class MainActivity extends Activity{}
is a component that runs in the background to perform long-running operations.
service
might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity.
service
A service is implemented as a subclass of Service class as follows –
public class MyService extends Service{}
simply respond to broadcast messages from other applications or from the system.
Broadcast Receivers
implemented as a subclass of BroadcastReceiver class and each message is broadcaster as an Intent object
broadcast receiver
BroadCast Receiver Syntax
public class MyReceiver extends Broadcast Receiver{
public void onReceive(context,intent){}
}
component supplies data from one application to others on request.
content providers
A content provider component supplies data from one application to others on request. Such requests are handled by the methods of the ____ class.
ContentResolver
The data may be stored in the file system, the database or somewhere else entirely
content providers
is implemented as a subclass of ContentProvider class and must implement a standard set of APIs that enable other applications to perform transactions.
content providers
represents a portion of user interface in an Activity
Fragment
UI elements that are drawn on-screen including buttons, lists forms etc.
Views
view hierarchies that control screen format and appearance of the views
Layouts
messages wiring components together
Intents
external elements, such as strings, constants and drawable pictures
Resources
configuration file for the application
Manifest
are the additional files and static content that your code uses, such as bitmaps, layout definitions, user interface strings, animation instructions, and more
Resources
are always maintained separately in various sub-directories under res/ directory of the project
resources
Android Resources are always maintained separately in various sub-directories under ___ directory of the project
res/
XML files that define Property animations
animator/
XML files that define property animations. They are saved in res/anim/ folder and accessed from the R.anim class
anim/
XML files that define property animations. They are saved in ___ folder and accessed from the ___ class
res/anim/, R.anim
XML files that define Tween animations.
anim/
____ can also be saved in this directory, but the animator/directory is preferred for property animations to distinguish between the two types
Property animations
XML files that define a state list of colors.
color/
XML files that define a state list of colors. They are saved in __ and accessed from the ___ class
res/color/, R.color
images like .png, .jpg, .gif or XML files that are compiled into bitmaps, state lists, shapes, animation drawable.
drawable/
images like .png, .jpg, .gif or XML files that are compiled into bitmaps, state lists, shapes, animation drawable. They are saved in __ and accessed from the ___ class
res/drawable/, R.drawable
Bitmap files (PNG, .9.png, JPG, or GIF) or XML files that are compiled into the following drawable resource subtypes
drawable/
Bitmap files
Nine-patches (re-sizeable bitmaps)
State lists
Shapes
Animation drawables
Other drawables
Bitmap files (PNG, .9.png, JPG, or GIF) or XML files that are compiled into the following drawable resource subtypes:
XML files that define a user interface layout.
layout/
XML files that define a user interface layout. They are saved in ____ and accessed from the ___class.
res/layout/, R.layout
XML files that define application menus, such as an Options Menu, Context Menu, or Sub Menu.
menu/
XML files that define application menus, such as an Options Menu, Context Menu, or Sub Menu. They are saved in ___ and accessed from the ___class
res/menu/, R.menu
Arbitrary files to save in their raw form.
raw/
Arbitrary files to save in their raw form. You need to call ______ with the resource ID, which is _____ to open such raw files.
Resources.openRawResource(), R.raw.filename
Arbitrary files to save in their raw form. To open these resources with a raw _____, call Resources.openRawResource() with the resource ID, which s R.raw.filename.
InputStream
However, if you need access to the original filenames and file hierarchy, consider saving resources in the ____instead of res/raw/. Files in assets/ aren’t given a resource ID, so you can only read them using ___-
asset/ directory, AssetManager
XML files that contain simple values, such as strings, integers, and colors
values/
Whereas XML resource files in other res/ subdirectories define a single resource based on the XM filename, files in the values/ directory describe multiple resources
values/
For a file in values/ directory, each child of the ____ element defines a single resource. For example, a <string> element creates an R.string resource, and a <color> element creates an R.color resource</color></string>
<resources>
</resources>
Because each resource is defined with its own XML element, you can name the file whatever you want and place different resource types in one file.
t
arrays.xml for resources arrays
Typed arrays
colors.xml for
Color Values
dimens.xml for
Dimension Values
strings.xml for
String values
styles.xml for
Styles
Arbitrary XML files that can be read at runtime by calling Resources.getXML().
xml/
xml/ - Arbitrary XML files that can be read at runtime by calling ____.
Resources.getXML()
Arbitrary XML files that can be read at runtime by calling Resources.getXML(). Various XML configuration files must be saved here, such as a ____
Search configuration.
Font files with extensions such as TTF, OTF, or TTC, or XML files that include a <font-family> element.</font-family>
font/
when your Android application is compiled, a R class gets generated, which contains resource IDs for all the resources available in your res/ directory. You can use R class to access that resource using sub-directory and resource name or directly resource ID
Accessing Resources in Code
when your Android application is compiled, a _class gets generated, which contains resource IDs for all the resources available in your res/ directory.
R
when your Android application is compiled, a R class gets generated, which contains resource IDs for all the resources available in your ___ directory.
res/
You can use ___ to access that resource using sub-directory and resource name or directly resource ID
R class
to access
res/drawable/myimage.png and set an ImageView, you will use following cod
ImageView imageView = (ImageView) findViewById(R.id.myimageview);
imageView.setImageResource(R.drawable.myimage);
Consider next example where
res/values/strings.xml has following definition –
<?xml version=”1.0” encodding=”utf-8”?>
<resources>
<string>Hello, World!</string>
</resources>
you can set the text on a TextView object with ID msg using a resource ID as follows –
TextView msgTextView (TextView) findViewById(R.id.msg);
msgTextView.setText(R.string.hello);
Consider a layout
res/layout/activity_main.xml with the following definition –
<?xml version=”1.0” encodding=”utf-8”?>
<LinearLayout>
<TextView></TextView>
<button></button>
</LinearLayout>
This application code will load this layout for an Activity, in the onCreate() method as follows –
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Consider the following resource XML
res/values/strings.xml file that includes a color resource and a string resource –
Now you can use these resources in the following layout file to set the text color and text string as follows –
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
<?xml version=”1.0” encodding=”utf-8”?>
<EditText></EditText>
is one screen of the Android app’s user interface
Android activity
may contain one or more activities, meaning one or more screens.
Android app
tarts by showing the main activity, and from there the app may make it possible to open additional activities
Android app
Activity Life Cycle
Created -> Started -> Resumed -> Paused -> Stopped -> Destroyed
Any Android activity goes through a certain ___ during its life inside the Android app
life cycle
All activities in your Android apps are represented by an ___
activity class.
All activities in your Android apps are represented by an activity class. These activity classes are subclasses of _____
android.app.Activity.
contains a set of methods that corresponds to the life cycle
activity class.
this is the first callback and called when the activity is first created
onCreate()
this callback is called when the activity becomes visible to the user
onStart()
this is called when the user starts interacting with the application
onResume()
the paused activity does not receive user input and cannot execute any code and called when the current activity is being paused and the previous activity is being resumed
onPause()
this callback is called when the activity is no longer visible
onStop()
this callback is called before the activity is destroyed by the system
onDestroy()
this callback is called when the activity restarts after stopping it
onRestart()
is a subclass of the Android class android.app.Activity
activity
An activity is a subclass of the Android class ____
android.app.Activity
All activities, should be documented on your ___
manifest file.
All activities, should be documented on your manifest file. To do this, add an ___ element as a child of the ____ element
<activity>, <application>
</application></activity>
An activity is a subclass of the Android class android.app.Activity
import android.app.Activity
All activities, should be documented on your manifest file. To do this, add an <activity> element as a child of the <application> element</application></activity>
<activity></activity>
An activity class loads all the UI component using the XML file available in ____ of the project during the onCreate() callback.
res/layout folder
An activity class loads all the UI component using the XML file available in res/layout folder of the project during the ____ callback.
onCreate()
Following statement loads UI components from res/layout/activity_main.xml file:
setContentView(R.layout.activity_main);
Defines the structure for a user interface in your app, such as an activity.
Layouts
All elements are built using a hierarchy of ___ and ___ objects
View, ViewGroup
All elements are built using a hierarchy of View and ViewGroup objects
Layouts
usually draws something the user can see and interact with
View
invisible container that defines the layout structure for View and other ViewGroup objects
ViewGroup
ViewGroup - invisible container that defines the layout structure for View and other ViewGroup objects
View, ViewGroup
Each layout file must contain exactly ____, which must be a View or ViewGroup object
one root element
Once you’ve defined the root element, you can add additional layout objects or widgets as ____
child elements
objects are usually called “widgets” cand can be one of many subclasses, such as Button or TextView
View
objects are usually called “layouts” can be one of many types that provide a different layout structure, such as LinearLayout or ConstraintLayout
ViewGroup
Declare UI Elements in XML
Instantiate Layout Elements at Runtime
View and ViewGroup can be declared in two ways:
Declare UI elements in XML
create layout in xml ->
load the xml from activity:
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Instantiate Layout Elements at Runtime
public class MainActivity extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
TextView textView1 = new TextView(this);
textView1.setText(“Name:”);
EditText editText1 = new EditText(this);
editText1.setText(“Enter Name”);
Button button1 = new Button(this);
button1.setText(“Add Name”);
LinearLayout linearLayout = newLinearLayout(this);
linearLayout.addView(textView1);
linearLayout.addView(editText1);
linearLayout.addView(button1);
setContentView(linearLayout);
}
}
defines the architecture for the UI in an Activity or a component of a UI
layout resource
Layout Resource file location:
res/layout/filename.xml
file location:
res/layout/filename.xml
The filename will be used as the ____
resource ID
Resource pointer to a view (or subclass) resource
Layout Resource compiled resource datatype:
In Java: R.layout.filename
In XML: @[package:]layout/filename
Layout Resource resource reference:
Layout Resource - syntax
<?xml version=”1.0” encodding=”utf-8”?>
<ViewGroup
xmlns:android=”https://schemas blah
android:id=”@[+][package:]id/resource_name”
android:layout_height=[“dimension” | “match_parent” | “wrap_content”]
android:layout_width=[“dimension” | “match_parent” | “wrap_content”]
[ViewGroup-specific attributes] >
<View
android:id=”@[+][package:]id/resource_name”
android:layout_height=[“dimension” | “match_parent” | “wrap_content”]
android:layout_width=[“dimension” | “match_parent” | “wrap_content”]
[View-specific attributes] >
<requestFocus></requestFocus>
</View>
<ViewGroup>
<View></View>
</ViewGroup>
<include></include>
</ViewGroup>
a container for other View elements
<ViewGroup>
</ViewGroup>
LinearLayout, Relative Layout, and FrameLayout
<ViewGroup>
</ViewGroup>
Do not assume that any derivation from ViewGroup will accept nested Views.
<ViewGroup>
</ViewGroup>
Some ViewGroups are implementations of the _____ , which determines its children only from an Adapter
AdapterView class
android:id
android:layout_height
android:layout_width
<ViewGroup> attributes
</ViewGroup>
an individual UI component, generally referred to as a “widget”
<View>
</View>
Different kinds of ____ include TextView, Button, and CheckBox
View objects
android:id
android:layout_height
android:layout_width
<View> attributes
</View>
More attributes are supported by the ___, and many more are supported by each implementation of View
View base class
Resource ID. A unique resource name for the element, which you can use to obtain a reference to the View or ViewGroup from your application
android:id
For ID value, use syntax form: ____
“@+id/name”.
The ___ symbol, indicates that this is a new resource ID and the aapt tool will create a new resource integer in the R.java.class, if it doesn’t already exist
plus
The plus symbol, +, indicates that this is a new resource ID and the ___ tool will create a new resource integer in the R.java.class, if it doesn’t already exist
aapt
Dimension or keyword. Required.
android:layout_height and android:layout_width
can be expressed using any of the dimension units supported by Android (px, dp, sp, pt, in, mm) or
height and width
sets the dimension to match that of a parent element.
match_parent
match_parent - sets the dimension to match that of a parent element. Added in ___ to deprecate fill_parent
API Level 8
sets the dimension only to the size required to fit the content of this element
wrap_content
you can create your own custom View and ViewGroup elements and apply them to your layout the same as a standard layout element. You can also specify the attributes supported in the XML element
Custom View elements
Loading View
Define a view/widget in the layout file and assign it a unique ID:
Then create an instance of the view object and capture it from the layout (typically in the onCreate() method)
<button></button>
Button myButton = (Button) findViewById(R.id.my_button);
used to uniquely identify the view and ViewGroup
android:id
used to define the width for View and ViewGroup elements in layout
android:layout_width
used to define the height for View and ViewGroup elements in layout
android:layout_height
used to define the extra space in left slide for View and ViewGroup elements in layout
android:layout_marginLeft
used to define the extra space in right side for View and ViewGroup elements in layout
android:layout_marginRight
used to define the extra space on top for View and ViewGroup elements in layout
android:layout_marginTop
used to define the extra space in bottom side for View and ViewGroup elements in layout
android:layout_marginBottom
used to define the left slide padding for View and ViewGroup elements in layout files
android:paddingLeft
used to define the right side padding for View and ViewGroup elements in layout files
android:paddingRigh
used to define padding for View and ViewGroup elements in layout files on top side
android:paddingTop
used to define the bottom side padding for View and ViewGroup elements in layout files
android:paddingBottom
used to define how child Views are positioned
android:layout_gravity
Linear Layout
Relative Layout
Frame Layout
Table Layout
Web View
List View
Grid View
Layout Types
is a ViewGroup subclass which s used to render all child View instances one by one either in Horizontal direction or Vertical direction based on the orientation property
LinearLayout
In android, we can specify the linear layout orientation using ______ attribute
android:orientation attribute
which is used to specify the position of child View instances relative to each other (Child A to the left of Child B) or relative to the parent (Aligned to the top of parent)
Relative Layout
very useful to design user interface because by using ___ we can eliminate the nested view groups and keep our layout hierarchy flat, which improves performance of application
Relative Layout
is a ViewGroup subclass which is used to specify the position of View instances
Frame Layout
It contains on the top of each other to display only single View inside the ____
Frame Layout
designed to block out an area on the screen to display a single item
Frame Layout
It acts as a placeholder on the screen and it is used to hold a single child view
Frame Layout
The child views are added in a stack and the most recently added child will show on the top.
FrameLayout
The child views are added in a stack and the most recently added child will show on the top. We can add multiple children views to FrameLayout and control their position by using ____ in FrameLayout
gravity attributes
is a ViewGroup subclass which is used to display the child View elements in rows and columns
Table Layout
It position its children elements into rows and columns and it won’t display any border lines for rows, columns, or cells
Table Layout
in android will work same as HTML table and table will have as many columns as the row with the most cells.
Table Layout
can be explained as <table> and TableRow is like <tr> element
Table Layout
is an extension of View class and it is used to show the static HTML web pages content or remote web pages content with URl in android applications as part of our activity layout
WebView Layout
will act as an embedded browser to include the web pages content in our activity layout and it won’t contain any features of normal browser, such as address bar, navigation controls, etc.
WebView Layout
is a ViewGroup which is used to display the list of scrollable of items in multiple rows and the list items are automatically inserted to the list using an adapter
ListView Layout
ListView is a ViewGroup which is used to display the list of scrollable of items in multiple rows and the list items are automatically inserted to the list using an ____
adapter
acts as an intermediate between the data sources and adapter views such as ListView, Gridview to fill the data into adapter views.
adapter
will hold the data and iterates through a n items in data set and generate views for each item in the list
adapter
expects an Array or List as input
ArrayAdapter
accepts an instance of cursor as an input
CursorAdapter
accepts a static data defined in the resources
SimpleAdapter
generic implementation for all three adapter types and it can be used for ListView, GridView, orSpinners based on our requirements
BaseAdapter
is a ViewGroup which is used to display items in a two dimensional, scrollable grid and grid items are automatically inserted to the gridview layout using a list adapter
GridView Layout
are the interactive components in your app’s user interface.
Input controls
Android provides a wide variety of controls you can use in you UI, such as buttons, text fields, seek bars, check box, zoom buttons, toggle buttons, and many more.
Input controls
A ___ is an object that draws something on the screen that the user can interact with and a _____ is an object that holds other ____ objects in order to define the layout of the user interface
view, ViewGroup
this control is used to display text ot the user
TextView
predefined subclass of TextView that includes rich editing capabilities
EditText
a view that is similar to EditText, except that it shows a list of completion suggestions
AutoCompleteTextView
a push-button that can be pressed, or clicked, by the user to perform an action
ButtonA
an AbsoluteLayout which enables you to specify the exact location of its children. This shows a button with an image (instead of text) that can be pressed or clicked by the user
ImageButtonAn
n on/off switch that can be toggled by the user. You should use check box when presenting users with a group of selectable options that are not mutually exclusive
CheckBox
an on/off with a light indicator
ToggleButton
has two states: either checked or unchecked.
RadioButton
is used to group together one or more RadioButtons
RadioGroup
provides visual feedback about some ongoing tasks, such as when you are performing a task in the background
ProgressBar
a drop-down list that allows users to select one value from a set
Spinner
enables users to select a time of the day, in either 24-hour mode or AM/PM mode
TimePicker
enables users to select a date of the day
DatePicker
may have a unique ID assigned to it which will identity the View uniquely within the tree
View objects
is an interface in the View class that contains a single callback method.
event listener
methods will be called by the Android framework when the VIew to which the listener has been registered is triggered by user interaction with the item in the UI.
Event Handling
This is called when the user either clicks or touches or focuses upon any widget like button, text, image etc.
onClick() OnClickListener()
This is called when the user either click or touches or focuses upon any widget like button, text, image etc. for one or more seconds.
onLongClick()
OnLongClickListener()
This is called when the widget looses its focus ie. user goes away from the view item.
OnFocusChange()
OnFocusChangeListener()
This is called when the user is focused on the item and presses or releases a hardware key on the device.
onKey()
OnFocusChangeListener()
This is called when the user either clicks or touches or focuses upon any widget like button, text, image tc for one or more seconds.
onTouch()
OnTouchListener()
This is called when the user presses the key, releases the key, or any move gesture on the screen
onFocusChange()
OnFocusChangeListener()
This is called when the user selects a menu item.
onMenuItemClick()
OnMenuItemClickListener()
This is called when the context menu is being built (as the result of a sustained “long click)
onCreateContextMenu()
onCreateContextMenuItemListener()
Implement the nested interface in your Activity or define it as an anonymous class
Event Implementation
This will avoid the extra class load and object allocation
OnClickListene
is an abstract description of an operation to be performed.
Android Intent
can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service
Android Intent
is a passive data structure holding an abstract description of an operation to be performed
Intent object
Explicit
Implicit
There are following two types of intents supported by Android:
going to be connected internal world of application, suppose if you want to connect one activity to another activity,
Explicit intent
do not name a target and the field for the component name is left blank.
Implicit Intents
are often used to activate components in other applications
Implicit intents
The target component which receives the intent can use the ____ method to get the extra data sent by the source component
getExtras()
We can start adding data into the Intent object, we use the method defined in the Intent class ___or ____ to store certain data as a key value pair or Bundle data object.
putExtra(), putExtras()
We can start adding data into the Intent object, we use the method defined in the Intent class putExtra() or putExtras() to store certain data as a key value pair or Bundle data object. These key-value pairs are known as ___ in the sense we are talking about Intents
Extras
To retrieve the data, we use the method ____ on the NextActivity from the intent
getExtra()
is a mapping from String keys to various parcelable values
Bundle
We can store any number of key-value pairs in a ___ object and simply pass this object through the intent
Bundle
We can use the _____ in the target activity/class to get the attached bundle and extract the data stored in it
Intent.getExtras()
We can also pass Java class objects through ____, maybe an ArrayList, HashMap, or any type of object, we can serialize in one end get it at the other end.
bundles
To put an object to a bundle, we use ____
putSerializable(“KEY”,OBJECT)
To retrieve this object, in the target activity, we simply get the serializable and assign it to an object of same type
by typecasting the return value of ____
getSerializable(“KEY”, DEFAULT)
simple feedback about an operation in a small popup.
toast
It only fills the amount of space required for the message and the current activity remains visible and interactive.
toast
automatically disappear after a timeout
toast
First, instantiate a Toast object with one of the ___ methods.
makeText()
First, instantiate a Toast object with one of the makeText() methods.
This method takes three parameters: ____
the application Context, the text message, and the duration for the toast.
You can display the toast notification with ___
show()
You can also chain your methods and avoid holding on to the Toast object
t
appears near the bottom of the screen, centered horizontally.
standard toast notification
A standard toast notification appears near the bottom of the screen, centered horizontally.
You can change this position with the ____ method.
setGravity(int, int, int)
setGravity(int, int, int) accepts three parameters:
a Gravity constant, an x-position offset, and a y-position offset.
You can change this position with the setGravity(int, int, int) method. This accepts three parameters: a Gravity constant, an x-position offset, and a y-position offset.
If you want to nudge the position to the right, increase the value of the ____ parameter. To nudge it down, increase the value of the ____ parameter
second, last
is a message you can display to the user outside of your application’s normal UI.
notification
When you tell the system to issue a notification, it first appears as an icon in the _____
notification area.
To see the details of the notification, the user opens the ____
notification drawer.
Both the notification area and the notification drawer are _____ that the user can view at any time
system-controlled areas
____ appear to users in different locations and formats, such as an icon in the status bar, a more details entry in the notification drawer, as a badge on the app’s icon, and on paired wearables automatically
Notifications
Beginning with Android 5.0, notifications can briefly appear in a floating window called a ____
heads-ups notification.
behavior is normally for important notifications that the user should know about immediately, and it appears only if the device is unlocked
heads-ups notification.
appears the moment your app issues the notification and it disappears after a moment, but remains visible in the notification drawer as usual.
heads-ups notification.
The user’s activity is in fullscreen mode (the app uses fullScreenIntent)
The notification has high priority and uses ringtone or vibrations on devices running on Android 7.1 (API level 25) and lower
The notification channel has high importance on devices running Android 8.09 (API level 26) and higher
Example conditions that might trigger heads-up notifications include the following:
In supported launchers on devices running Android 8.0 (API level 26) and higher, app icons indicate new notifications with a _____ on the corresponding app launcher icon.
colored “badge” (also known as a “notification dot”)
Users can ____ on an app icon to see the notifications for that app.
long-press
The _____ is determined by system templates – your app simply defines the contents for each portion of the template. Some details of the notification appear only in the expanded view
design of a notification
Small icon: This is required and set with ___
setSmallIcon()
App name: This is ____
provided by the system
Time stamp: This is provided by the system but you can override with _____ or hide it with ____
setWhen() or hide it with setShowWhen(false).
Large icon: This is optional(usually used only for contact photos, do not use it for your app icon) and set with ____
setLargeIcon()
Title: This is optional and set with ____
setContentTitle()
Text: This is optional and set with ____
setContentText()
Although most projects created with Android Studio include the necessary dependencies to use ____
NotificationCompat,
This is the only user-visible content that is required
A small icon, set by setSmallIcon().
On notifications, to get started, you need to set the notification’s content and channel using a ____ object.
NotificationCompat.Builder
The body text, set by ___
setContentTitle()
The notification priority, set by ____
setPriority()
The ___ determines how intrusive the notification should be on Android 7.1 and lower. (For Android 8.0 and higher, you must instead set the channel importance)
priority
By default, the notification’s text content is truncated to fit one line.
t
If you want your notification to be longer, you can enable an expandable notification by adding a style template with ___
setStyle()
Before you can deliver the notification on Android 8.0 and higher, you must register your app’s notification channel with the system by passing an instance of _______
NotificationChannel to createNotificationChannel()
Every notification should respond to a tap, usually to open an activity in your app that corresponds to the notification. To do so, you must specify a content intent defined with a ____
PendingIntent object and pass it to setContentIntent()
Notice that the NotificationChannel constructor requires an importance, using one of the constants from the NotificationManager class. This parameter determines how to interrupt the user for any notification that belongs to this channel - though you must also set the priority with ____ to support Android 7.1 and lower
setPriority()
The ___ method shown earlier helps preserve the user’s expected navigation experience after they open your app via the notification.
setFlags()
An activity that exists exclusively for responses to the notification. There’s no reason the user would navigate to this activity during normal app use, so the activity starts a new task instead of being added to your app’s existing ____.
task and back stack
An activity that exists in your app’s regular app flow. In this case, starting the activity should create a back stack so that the user’s expectations for the _____ is preserved
Back and Up buttons
To make the notification appear, call ____, passing it a unique ID for the notification and the result of NotificationCompat.Builder.build().
NotificationManagerCompat.notify()
Beginning with Android 8.1 (API level 27), apps cannot make a notification ____. If your app posts multiple notifications in one second, they all appear as expected, but only the first notification per second makes a sound
sound more than once per second
Remember to ____ that you pass to NotificationManagerCompat.notify() because you’ll need it later if you want to update or remove the notification
save the notification ID
is an opensource SQL database that stores data to a text file on a device.
SQLite
Android comes in with built in __ database implementation
SQLite
supports all the relational database features.
SQLite
a formal declaration of how the database is organized.
schema:
is reflected in the SQL statements that you use to create your database
schema:
You may find it helpful to create a ____, known as a contract class, which explicitly specifies the layout of your schema in a systematic and self-documenting way
companion class
is a container for constants that define names for URls, tables, and columns.
contract class
allows you to use the same constants across all the other classes in the same package.
contract class
This lets you change a column name in one place and have it propagate throughout your code.
contract class
A good way to organize a contract class is to put definitions that are global to your whole database in the ___ of the class. Then create an inner class for each table. Each inner class enumerates the corresponding table’s columns.
root level
By implementing the ____ interface, your inner class can inherit a primary key field called ___ that some Android classes such as CursorAdapter expect it to have. It’s not required, but this can help your database work harmoniously with the Android framework
BaseColumns, _ID
contains a useful set of APIs for managing your database.
SQLiteOpenhelper class
When you use this class to obtain references to your database, the system performs the potentially long-running operations of creating and updating the database only when needed and not during app startup. All you need to do is call ___
getWriteableDatabase() or getReadableDatabase().
To access your database, instantiate your subclass of ____:
SQLiteOpenHelper
Insert data into the database by passing a ContentValues object to the __ method:
insert()
To read from a database, use the __ method, passing it your selection criteria and desired columns.
query()
stands for JavaScript Object Notation
JSON
JSON stands for
JavaScript Object Notation
is a lightweight format for storing and transporting data
JSON
is often used when data is sent from a server to a web page
JSON
is “self-describing” and easy to understand
JSON
Data is in name/value pairs
Data is separated by commas
Curly braces hold objects
Square brackets hold arrays
JSON Syntax Rules
is written as name/value pairs, just like JavaScript object properties. A name/value pair consists of a field name (in double quotes), followed by a colon, followed by a value:
JSON Data - A Name and a Value
are written inside curly braces. Just like in JavaScript, objects can contain multiple name/value pairs:
JSON Objects
are written inside square brackets. Just like in JavaScript, an array can contain objects:
JSON Arrays
Android provides four different classes to manipulate JSON data. These classes are ____
JSONArray, JSONObject, JSONStringer, and JSONTokenizer
In a JSON file, square bracket ( [ ) represents a
JSON Arrays
In a JSON file, curly bracket ( { ) represents a
JSON object
A JSON object contains a key that is just a string. Pairs of key/value make up a JSON object
Key
each key has a value that could be string, integer, or double e.t.c
Value
this method just Returns the value but in the form of Object type
get(String name
this method returns the boolean value specified by the key
getBoolean(String name)
this method returns the double value specified by the key
getDouble(String name)
this method returns the integer value specified by the key
getInt(String name)
this method returns the long value specified by the key
getLong(String name)
this method returns the number of name/value mappings in this object
length()
this method returns an array containing the string names in this object
names()
Modern, trending programming language that was released in 2016 by JetBrains
Kotlin
Compatible with Java
Works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.)
Concise and safe
Easy to learn, especially if you already know Java
Free to use
Big community/support
Kotlin
Mobile applications (specially Android apps)
Web development
Server side applications
Data Science
Uses of Kotlin
keyword is used to declare a function
fun
function is needed to execute a program
main()
In Kotlin, code statements do not have to ___
end with a semicolon (;)
Single line comments ->
//
Multi-line comments ->
/* */
keyword can create a variable whose reference will be immutable (which cannot be modified after its initialization).
val
keyword lets you create a variable whose reference will be mutable (which can be modified after its initialization).
var
Kotlin ___ require you to mention the type of a variable when declaring it (thanks to type inference)
does not
kotlin syntaxes
val time = 20
val greeting = if (time < 18){
“Good day.”
} else {
{Good evening.”
}
println(greeting)
val day = 4
val result = when (day){
1-> “Monday”
2-> “Tuesday”
else-> “hell day”
}
println(result)
val nums = arrayOf(1, 5, 10, 15, 20)
for (x in nums){
println(x)
}
for (nums in 5..15){
println(nums)
}
class Car{
var brand =””
var model = “”
var year = 0
}
valr c1 = Car()
c1.brand = “Ford”
c1.model = “Mustang”
c1.year = 1969
cass Car(var brand: String, var model: String, var year: Int)
fun main(){
val c1 = Car(“Ford”, “Musting”, 1969)
}
fun speed(maxSpeed: Int){
print ln(“Max speed is: “ = maxSpeed)
}
}