Agenda
 What is Android?
 History
 Android Distribute Channel
 Android System
 Architecture
 Development Environment
 Android Distribute Channel
 Programming Model
 Components Of Android
 Android Application Lifecycle
 Interface , Common Layout, Project Structure
 Steps to Development Sample App
What is Android?
 Android is an open source and Linux-based operating system for mobile devices
such as smartphones and tablet computers. Android was developed by the Open
Handset Alliance, led by Google, and other companies.
 It is not just another operating system for high-end mobile phones….
 It is a software platform, rather than just an OS, that has the potential to be
utilized in a much wider range of devices.
 Android is an application framework on top of Linux, which facilitates its
rapid deployment in many domains.
History
In October 2003 - Android Inc. founded by Andy Rubin, Rich
Miner, Nick Sears and Chris White
 August 2005 - Google acquired Android Inc.
 November 2007 - Open Handset Alliance (OHA) formed
 September 2008 - Android 1.0 released
 February 2024 – Android 15.0 Released Current version
And all android versions are named as desserts (Vanilla ice-cream)
Android Distribution Channels
 The main distribution channel is Google Play
(previously called Android Market),
 App Geyser - Alternative free distribution channel
 Lots of other third party sites that offer direct
download of the android APK.
Architecture
 Linux Kernal
Applications are abstracted from that - no need to worry about
lower layers
Apps use Gradle as a build system
Java & Kotlin as official languages for developing Apps
Android System
Development Environment
 Full Java IDEs - Eclipse, IntelliJ, Netbeans and recently Android Studio
 Plugins and a download of the Google Android SDK are required for all the
above IDEs except for Android Studio which comes in-built.
 Graphical UI Builders - IDEs also provide GUI Builder for drag and drop functionality
 Develop on Virtual Devices - You can specify your target configuration by specifying an
Android Virtual Device (AVD) during development
 Develop on Hardware Devices – Execute code on either the host-based
emulator or a real device, which is normally connected via USB.
 Powerful Debugging - Full Java debugger with on-device debugging and Android-specific
tools.
Programming Model
 An Android application consists of a number of resources which are bundled into an
archive – an Android package called as APK.
 Programs are generally written in Java, built using the standard Java
tools, and then the output file is processed to generate specific code
 An application is a set of components which are instantiated and run as required.
There is not really an entry point or main() function.
 There are four types of application component: activities, services, broadcast
receivers, and content providers
Components Of Android
 Activity
 Services
 Broadcast Receivers
 Content Providers
An Activity…
 A functional unit of the application, which may be
invoked by another activity.
 It has a user interface of some form.
 An application may incorporate a number of
activities.
 One activity may be nominated as the default which
means that it may be directly executed by the user.
A Service…
 Similar to an activity, except that it runs in the
background
 Runs without a UI.
 An example of a service might be a media player that
plays music while the
user performs other tasks.
Broadcast Receivers…
 Responds to a broadcast messages from other applications or from the
system.
 For example, it may be useful for the application to know when a picture
has been taken. This is the kind of event that may result in a broadcast
message.
Content Provider
 Supplies data from one application to others on request.
 Requests are handled by the methods of the ContentResolver class.
 The data may be stored in the file system, the database or somewhere
else
entirely.
Android Application
Lifecycle
Application Lifecycle details…
 Resumed – The activity is in the foreground and the user can
interact with it. (Also sometimes referred to as the "running"
state.)
 Paused – The activity is partially obscured by another activity—the
other activity that's in the foreground is semi-transparent or
doesn't cover the entire screen. It does not receive user input and
cannot execute any code.
 Stopped - The activity is completely hidden and not visible to the
user; it is considered to be in the background. While stopped, the
activity instance and all its state information such as member variables
is retained, but it cannot execute any code.
 The other states (Created and Started) are transient and the system
quickly moves from them to the next state by calling the next lifecycle
callback method. That is, after the system calls onCreate(), it quickly
calls onStart(), which is quickly followed by onResume().
Application Lifecycle details…
▸ Layout file format is .xml
▸ offers a visual editor
▸ creates the layout of the screen with building blocks
▸ showing text —> TextView
▸ show image —> ImageView
▸ let the user input text —> EditText
▸ ordering of blocks is done via layouts
Interface part of application
TextView
ImageView
EditText
How to Build a Interface?
▸ All building blocks are Views
Views have properties like:
▸ id
▸ width
▸ height
▸ Views are bundled together in ViewGroups
(fun fact: these are groups of views)
▸ Layout types define the order of elements in ViewGroups
How to Manage Views?
CommanLayouts
▸ LinearLayout
▸ RelativeLayout
▸ ConstraintLayout
Physical Project Structure in Android Studio
Physical Project Structure…
 /SRC
 The src folder contains the Java source code and resource files of your application
organized into packages
 /java
 It contains Java source code such as Activity , adapter and content provider files
 /res
 This folder is used to store raw asset files. You can keep any raw data in the assets
folder and there’s an asset manager in Android to read the data stored in the folder. The
raw data can be anything such as audio, video, images etc.
Physical Project Structure....
 /RES
 /res folder is where we store all our external resources for our applications
such as images, layout XML files, strings, animations, audio files etc.
 /res/drawable - This folder contains the bitmap file to be used in the program
 /res/layout - XML files that defines the User Interface goes in this folder.
 /res/values - XML files that define simple values such as
strings, arrays, integers, dimensions, colors, styles etc. are placed in this folder.
 /res/menu - XML files that define menus in your application goes in this folder
AndroidManifest.xml
 One of the most important file in the Android project structure. It contains all
the information about your application.
 When an application is launched, the first file the system seeks is the
AndroidManifest.xml file. It actually works as a road map of your application, for
the system
 The Android Manifest file contains information about:
 Components of your application such as Activities, services etc.
 User permissions required
 Minimum level of Android API required
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.specadel.ftest.hellowstudent">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Let Start to Develop
Sample App
introductiontoandroiddevelopment (2).ppt
introductiontoandroiddevelopment (2).ppt
introductiontoandroiddevelopment (2).ppt
introductiontoandroiddevelopment (2).ppt
introductiontoandroiddevelopment (2).ppt
introductiontoandroiddevelopment (2).ppt
introductiontoandroiddevelopment (2).ppt

introductiontoandroiddevelopment (2).ppt

  • 1.
    Agenda  What isAndroid?  History  Android Distribute Channel  Android System  Architecture  Development Environment  Android Distribute Channel  Programming Model  Components Of Android  Android Application Lifecycle  Interface , Common Layout, Project Structure  Steps to Development Sample App
  • 2.
    What is Android? Android is an open source and Linux-based operating system for mobile devices such as smartphones and tablet computers. Android was developed by the Open Handset Alliance, led by Google, and other companies.  It is not just another operating system for high-end mobile phones….  It is a software platform, rather than just an OS, that has the potential to be utilized in a much wider range of devices.  Android is an application framework on top of Linux, which facilitates its rapid deployment in many domains.
  • 3.
    History In October 2003- Android Inc. founded by Andy Rubin, Rich Miner, Nick Sears and Chris White  August 2005 - Google acquired Android Inc.  November 2007 - Open Handset Alliance (OHA) formed  September 2008 - Android 1.0 released  February 2024 – Android 15.0 Released Current version And all android versions are named as desserts (Vanilla ice-cream)
  • 4.
    Android Distribution Channels The main distribution channel is Google Play (previously called Android Market),  App Geyser - Alternative free distribution channel  Lots of other third party sites that offer direct download of the android APK.
  • 5.
  • 6.
     Linux Kernal Applicationsare abstracted from that - no need to worry about lower layers Apps use Gradle as a build system Java & Kotlin as official languages for developing Apps Android System
  • 7.
    Development Environment  FullJava IDEs - Eclipse, IntelliJ, Netbeans and recently Android Studio  Plugins and a download of the Google Android SDK are required for all the above IDEs except for Android Studio which comes in-built.  Graphical UI Builders - IDEs also provide GUI Builder for drag and drop functionality  Develop on Virtual Devices - You can specify your target configuration by specifying an Android Virtual Device (AVD) during development  Develop on Hardware Devices – Execute code on either the host-based emulator or a real device, which is normally connected via USB.  Powerful Debugging - Full Java debugger with on-device debugging and Android-specific tools.
  • 8.
    Programming Model  AnAndroid application consists of a number of resources which are bundled into an archive – an Android package called as APK.  Programs are generally written in Java, built using the standard Java tools, and then the output file is processed to generate specific code  An application is a set of components which are instantiated and run as required. There is not really an entry point or main() function.  There are four types of application component: activities, services, broadcast receivers, and content providers
  • 9.
    Components Of Android Activity  Services  Broadcast Receivers  Content Providers
  • 10.
    An Activity…  Afunctional unit of the application, which may be invoked by another activity.  It has a user interface of some form.  An application may incorporate a number of activities.  One activity may be nominated as the default which means that it may be directly executed by the user.
  • 11.
    A Service…  Similarto an activity, except that it runs in the background  Runs without a UI.  An example of a service might be a media player that plays music while the user performs other tasks.
  • 12.
    Broadcast Receivers…  Respondsto a broadcast messages from other applications or from the system.  For example, it may be useful for the application to know when a picture has been taken. This is the kind of event that may result in a broadcast message.
  • 13.
    Content Provider  Suppliesdata from one application to others on request.  Requests are handled by the methods of the ContentResolver class.  The data may be stored in the file system, the database or somewhere else entirely.
  • 14.
  • 15.
    Application Lifecycle details… Resumed – The activity is in the foreground and the user can interact with it. (Also sometimes referred to as the "running" state.)  Paused – The activity is partially obscured by another activity—the other activity that's in the foreground is semi-transparent or doesn't cover the entire screen. It does not receive user input and cannot execute any code.
  • 16.
     Stopped -The activity is completely hidden and not visible to the user; it is considered to be in the background. While stopped, the activity instance and all its state information such as member variables is retained, but it cannot execute any code.  The other states (Created and Started) are transient and the system quickly moves from them to the next state by calling the next lifecycle callback method. That is, after the system calls onCreate(), it quickly calls onStart(), which is quickly followed by onResume(). Application Lifecycle details…
  • 17.
    ▸ Layout fileformat is .xml ▸ offers a visual editor ▸ creates the layout of the screen with building blocks ▸ showing text —> TextView ▸ show image —> ImageView ▸ let the user input text —> EditText ▸ ordering of blocks is done via layouts Interface part of application
  • 18.
  • 19.
    How to Builda Interface? ▸ All building blocks are Views Views have properties like: ▸ id ▸ width ▸ height
  • 21.
    ▸ Views arebundled together in ViewGroups (fun fact: these are groups of views) ▸ Layout types define the order of elements in ViewGroups How to Manage Views?
  • 22.
  • 23.
    Physical Project Structurein Android Studio
  • 24.
    Physical Project Structure… /SRC  The src folder contains the Java source code and resource files of your application organized into packages  /java  It contains Java source code such as Activity , adapter and content provider files  /res  This folder is used to store raw asset files. You can keep any raw data in the assets folder and there’s an asset manager in Android to read the data stored in the folder. The raw data can be anything such as audio, video, images etc.
  • 25.
    Physical Project Structure.... /RES  /res folder is where we store all our external resources for our applications such as images, layout XML files, strings, animations, audio files etc.  /res/drawable - This folder contains the bitmap file to be used in the program  /res/layout - XML files that defines the User Interface goes in this folder.  /res/values - XML files that define simple values such as strings, arrays, integers, dimensions, colors, styles etc. are placed in this folder.  /res/menu - XML files that define menus in your application goes in this folder
  • 26.
    AndroidManifest.xml  One ofthe most important file in the Android project structure. It contains all the information about your application.  When an application is launched, the first file the system seeks is the AndroidManifest.xml file. It actually works as a road map of your application, for the system  The Android Manifest file contains information about:  Components of your application such as Activities, services etc.  User permissions required  Minimum level of Android API required
  • 27.
    AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifestxmlns:android="http://schemas.android.com/apk/res/android" package="com.specadel.ftest.hellowstudent"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
  • 28.
    Let Start toDevelop Sample App