SlideShare a Scribd company logo
1 of 30
SVN Solution PVT. LTD
Presentation On
Fundamentals of Android Development
Presented by
Prajakta Dharmpurikar
Basics Of Android
Development
Prajakta Dharmpurikar
Jr.Software/Weband
Androiddeveloper
What is Android?
 Android is an open source operating system, created by Google specifically for
use on mobile devices (cell phones and tablets)
 Linux based (2.6 kernel)
 Can be programmed in C/C++ but most app development is done in Java (Java
access to C Libraries via JNI (Java Native Interface))
 Supports Bluetooth, Wi-Fi, and 3G and 4G networking
 Software Stack for Mobile Devices
 Open Source Project
 Open Handset Alliance
Android Introduction
 Concepts:
 activity,
 service,
 broadcast receiver,
 content provider,
 intent,
 AndroidManifest
Application Components
 Activities – visual user interface focused on a single thing a user can do
 Services – no visual interface – they run in the background
 Broadcast Receivers – receive and react to broadcast announcements
 Content Providers – allow data exchange between applications
Activities
 Basic component of most applications
 Most applications have several activities that start each other as needed
 Each is implemented as a subclass of the base Activity class
 Each activity has a default window to draw in (although it may prompt for
dialogs or notifications)
 The content of the window is a view or a group of views (derived from View
or ViewGroup)
 Example of views: buttons, text fields, scroll bars, menu items, check boxes,
etc.
 View(Group) made visible via Activity.setContentView() method.
Services
 Does not have a visual interface
 Runs in the background indefinitely
 Examples
 Network Downloads
 Playing Music
 TCP/UDP Server
 You can bind to a an existing service and control its operation
Broadcast Receivers
 Receive and react to broadcast announcements
 Extend the class BroadcastReceiver
 Examples of broadcasts:
 Low battery, power connected, shutdown, timezone changed, etc.
 Other applications can initiate broadcasts
Content Providers
 Makes some of the application data available to other applications
 It’s the only way to transfer data between applications in Android (no shared
files, shared memory, pipes, etc.)
 Extends the class ContentProvider;
 Other applications use a ContentResolver object to access the data provided
via a ContentProvider
Intents
 An intent is an Intent object with a message content.
 Activities, services and broadcast receivers are started by
intents. ContentProviders are started by
ContentResolvers:
 An activity is started by Context.startActivity(Intent intent) or
Activity.startActivityForResult(Intent intent, int RequestCode)
 A service is started by Context.startService(Intent service)
 An application can initiate a broadcast by using an Intent in any of
Context.sendBroadcast(Intent intent),
Context.sendOrderedBroadcast(), and
Context.sendStickyBroadcast()
Intents View
GMail
Contacts
Home
Blogger
Chat
“Pick photo”
Blogger
Photo
Gallery
Photo Gallery
Picasa
Shutting down components
 Activities
 Can terminate itself via finish();
 Can terminate other activities it started via finishActivity();
 Services
 Can terminate via stopSelf(); or Context.stopService();
 Content Providers
 Are only active when responding to ContentResolvers
 Broadcast Receivers
 Are only active when responding to broadcasts
Android Manifest
 Its main purpose in life is to declare the components to the system:
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity android:name="com.example.project.FreneticActivity"
android:icon="@drawable/small_pic.png"
android:label="@string/freneticLabel"
. . . >
</activity>
. . .
</application>
</manifest>
Intent Filters
 Declare Intents handled by the current application (in the
AndroidManifest):
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
<application . . . >
<activity android:name="com.example.project.FreneticActivity"
android:icon="@drawable/small_pic.png“
android:label="@string/freneticLabel"
. . . >
<intent-filter . . . >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter . . . >
<action android:name="com.example.project.BOUNCE" />
<data android:mimeType="image/jpeg" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
. . .
</application>
</manifest>
Shows in the
Launcher and
is the main
activity to
start
Handles JPEG
images in
some way
Android development
Java Source
Generated
Class
Java
Compiler
Android
Libraries
.dex
File
Dalvik
VMResource XML
Android Manifest
The Android Software Stack:
Android versions
 Android 1.0
 Android 1.1
 Android 1.5 Cupcake
 Android 1.6 Donut
 Android 2.0 Eclair
 Android 2.2 Froyo
 Android 2.3 Gingerbread
 Android 3.0 Honeycomb
 Android 4.0 Ice Cream Sandwich
 Android 4.1 to 4.3 Jelly Bean
 Android 4.4 KitKat
 Android 5.0 Lollipop
 Android 6.0 Marshmallow
 Android 7.0 Nougat
 Android 8.0 Oreo
Android - Hello World Example
 Create Android Application
The first step is to create a simple Android Application using Android studio. When you click on Android studio icon, it will show screen as shown below;
Continue….
You can start your application development by calling
start a new android studio project. in a new installation
frame should ask Application name, package information
and location of the project.−
Continue….
After entered application name, it going to be called select the form factors your
application runs on, here need to specify Minimum SDK, in our tutorial, I have
declared as API23: Android 6.0(Mashmallow) −
Continue….
The next level of installation should contain selecting
the activity to mobile, it specifies the default layout for
Applications.
Continue….
At the final stage it going to be open development tool to write
the application code.
Anatomy of Android Application
Before you run your app, you should be aware of a few directories and files in the Android project −
The Main Activity File
 The main activity code is a Java file MainActivity.java. This is the actual application file which ultimately
gets converted to a Dalvik executable and runs your application. Following is the default code generated by
the application wizard for Hello World! application −
package com.example.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
The Manifest File
 Whatever component you develop as a part of your application, you must declare all its components
in a manifest.xml which resides at the root of the application project directory. This file works as an
interface between Android OS and your application, so if you do not declare your component in this
file, then it will not be considered by the OS. For example, a default manifest file will look like as
following file −
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tutorialspoint7.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
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>
The Strings File
 The strings.xml file is located in the res/values folder and it contains all the text that your
application uses. For example, the names of buttons, labels, default text, and similar types of
strings go into this file. This file is responsible for their textual content. For example, a default
strings file will look like as following file −
<resources>
<string name="app_name">HelloWorld</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main">MainActivity</string>
</resources>
The Layout File
 The activity_main.xml is a layout file available in res/layout directory, that is referenced by your
application when building its interface. You will modify this file very frequently to change the layout
of your application. For your "Hello World!" application, this file will have following content related
to default layout −
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" > <TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_centerHorizontal="true"
android:layout_centerVertical="true" android:padding="@dimen/padding_medium"
android:text="@string/hello_world" tools:context=".MainActivity" /> </RelativeLayout>
Continue……
 The TextView is an Android control used to build the GUI and it have various
attributes like android:layout_width, android:layout_height etc which are
being used to set its width and height etc.. The @string refers to the
strings.xml file located in the res/values folder. Hence, @string/hello_world
refers to the hello string defined in the strings.xml file, which is "Hello
World!".
Running the ApplicationRunning the Application
To run the app from Android studio, open one of your
project's activity files and click Run icon from the tool
bar. Android studio installs the app on your AVD and starts
it and if everything is fine with your set-up and application,
it will display following Emulator window −
….

More Related Content

What's hot

android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginner
Ajailal Parackal
 
Os eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdfOs eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdf
weerabahu
 
Android basic principles
Android basic principlesAndroid basic principles
Android basic principles
Henk Laracker
 

What's hot (20)

PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Introduction to Android App Development
Introduction to Android App DevelopmentIntroduction to Android App Development
Introduction to Android App Development
 
Learn Android app development in easy steps
Learn Android app development in easy stepsLearn Android app development in easy steps
Learn Android app development in easy steps
 
Introduction to Android Environment
Introduction to Android EnvironmentIntroduction to Android Environment
Introduction to Android Environment
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginner
 
Android
AndroidAndroid
Android
 
Android versions
Android versionsAndroid versions
Android versions
 
ANDROID
ANDROIDANDROID
ANDROID
 
Android by LAlitha
Android by LAlithaAndroid by LAlitha
Android by LAlitha
 
Introduction to Android development - Presentation
Introduction to Android development - PresentationIntroduction to Android development - Presentation
Introduction to Android development - Presentation
 
Android Development Workshop
Android Development WorkshopAndroid Development Workshop
Android Development Workshop
 
Os eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdfOs eclipse-androidwidget-pdf
Os eclipse-androidwidget-pdf
 
Android basic principles
Android basic principlesAndroid basic principles
Android basic principles
 
Android report
Android reportAndroid report
Android report
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorial
 
Android Programming Seminar
Android Programming SeminarAndroid Programming Seminar
Android Programming Seminar
 
First Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting IntroductionFirst Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting Introduction
 
Mobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osamaMobile appliaction w android week 1 by osama
Mobile appliaction w android week 1 by osama
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
 
Android Report
Android ReportAndroid Report
Android Report
 

Similar to Android Development Basics

Android application structure
Android application structureAndroid application structure
Android application structure
Alexey Ustenko
 
Android : a linux-based mobile operating system
Android : a linux-based mobile operating systemAndroid : a linux-based mobile operating system
Android : a linux-based mobile operating system
Clément Escoffier
 
Android Development project
Android Development projectAndroid Development project
Android Development project
Minhaj Kazi
 

Similar to Android Development Basics (20)

Nativa Android Applications development
Nativa Android Applications developmentNativa Android Applications development
Nativa Android Applications development
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
 
Unit2
Unit2Unit2
Unit2
 
Beginning android
Beginning android Beginning android
Beginning android
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentals
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101
 
Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1
 
Android application structure
Android application structureAndroid application structure
Android application structure
 
Android : a linux-based mobile operating system
Android : a linux-based mobile operating systemAndroid : a linux-based mobile operating system
Android : a linux-based mobile operating system
 
Hello android world
Hello android worldHello android world
Hello android world
 
Android Development project
Android Development projectAndroid Development project
Android Development project
 
Android For Java Developers
Android For Java DevelopersAndroid For Java Developers
Android For Java Developers
 
Android application development
Android application developmentAndroid application development
Android application development
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android 101 Session @thejunction32
Android 101 Session @thejunction32Android 101 Session @thejunction32
Android 101 Session @thejunction32
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
 

Recently uploaded

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Recently uploaded (20)

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 

Android Development Basics

  • 1. SVN Solution PVT. LTD Presentation On Fundamentals of Android Development Presented by Prajakta Dharmpurikar
  • 2. Basics Of Android Development Prajakta Dharmpurikar Jr.Software/Weband Androiddeveloper
  • 3. What is Android?  Android is an open source operating system, created by Google specifically for use on mobile devices (cell phones and tablets)  Linux based (2.6 kernel)  Can be programmed in C/C++ but most app development is done in Java (Java access to C Libraries via JNI (Java Native Interface))  Supports Bluetooth, Wi-Fi, and 3G and 4G networking  Software Stack for Mobile Devices  Open Source Project  Open Handset Alliance
  • 4. Android Introduction  Concepts:  activity,  service,  broadcast receiver,  content provider,  intent,  AndroidManifest
  • 5. Application Components  Activities – visual user interface focused on a single thing a user can do  Services – no visual interface – they run in the background  Broadcast Receivers – receive and react to broadcast announcements  Content Providers – allow data exchange between applications
  • 6. Activities  Basic component of most applications  Most applications have several activities that start each other as needed  Each is implemented as a subclass of the base Activity class  Each activity has a default window to draw in (although it may prompt for dialogs or notifications)  The content of the window is a view or a group of views (derived from View or ViewGroup)  Example of views: buttons, text fields, scroll bars, menu items, check boxes, etc.  View(Group) made visible via Activity.setContentView() method.
  • 7. Services  Does not have a visual interface  Runs in the background indefinitely  Examples  Network Downloads  Playing Music  TCP/UDP Server  You can bind to a an existing service and control its operation
  • 8. Broadcast Receivers  Receive and react to broadcast announcements  Extend the class BroadcastReceiver  Examples of broadcasts:  Low battery, power connected, shutdown, timezone changed, etc.  Other applications can initiate broadcasts
  • 9. Content Providers  Makes some of the application data available to other applications  It’s the only way to transfer data between applications in Android (no shared files, shared memory, pipes, etc.)  Extends the class ContentProvider;  Other applications use a ContentResolver object to access the data provided via a ContentProvider
  • 10. Intents  An intent is an Intent object with a message content.  Activities, services and broadcast receivers are started by intents. ContentProviders are started by ContentResolvers:  An activity is started by Context.startActivity(Intent intent) or Activity.startActivityForResult(Intent intent, int RequestCode)  A service is started by Context.startService(Intent service)  An application can initiate a broadcast by using an Intent in any of Context.sendBroadcast(Intent intent), Context.sendOrderedBroadcast(), and Context.sendStickyBroadcast()
  • 12. Shutting down components  Activities  Can terminate itself via finish();  Can terminate other activities it started via finishActivity();  Services  Can terminate via stopSelf(); or Context.stopService();  Content Providers  Are only active when responding to ContentResolvers  Broadcast Receivers  Are only active when responding to broadcasts
  • 13. Android Manifest  Its main purpose in life is to declare the components to the system: <?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android:name="com.example.project.FreneticActivity" android:icon="@drawable/small_pic.png" android:label="@string/freneticLabel" . . . > </activity> . . . </application> </manifest>
  • 14. Intent Filters  Declare Intents handled by the current application (in the AndroidManifest): <?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android:name="com.example.project.FreneticActivity" android:icon="@drawable/small_pic.png“ android:label="@string/freneticLabel" . . . > <intent-filter . . . > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter . . . > <action android:name="com.example.project.BOUNCE" /> <data android:mimeType="image/jpeg" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> . . . </application> </manifest> Shows in the Launcher and is the main activity to start Handles JPEG images in some way
  • 17. Android versions  Android 1.0  Android 1.1  Android 1.5 Cupcake  Android 1.6 Donut  Android 2.0 Eclair  Android 2.2 Froyo  Android 2.3 Gingerbread  Android 3.0 Honeycomb  Android 4.0 Ice Cream Sandwich  Android 4.1 to 4.3 Jelly Bean  Android 4.4 KitKat  Android 5.0 Lollipop  Android 6.0 Marshmallow  Android 7.0 Nougat  Android 8.0 Oreo
  • 18. Android - Hello World Example  Create Android Application The first step is to create a simple Android Application using Android studio. When you click on Android studio icon, it will show screen as shown below;
  • 19. Continue…. You can start your application development by calling start a new android studio project. in a new installation frame should ask Application name, package information and location of the project.−
  • 20. Continue…. After entered application name, it going to be called select the form factors your application runs on, here need to specify Minimum SDK, in our tutorial, I have declared as API23: Android 6.0(Mashmallow) −
  • 21. Continue…. The next level of installation should contain selecting the activity to mobile, it specifies the default layout for Applications.
  • 22. Continue…. At the final stage it going to be open development tool to write the application code.
  • 23. Anatomy of Android Application Before you run your app, you should be aware of a few directories and files in the Android project −
  • 24. The Main Activity File  The main activity code is a Java file MainActivity.java. This is the actual application file which ultimately gets converted to a Dalvik executable and runs your application. Following is the default code generated by the application wizard for Hello World! application − package com.example.helloworld; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
  • 25. The Manifest File  Whatever component you develop as a part of your application, you must declare all its components in a manifest.xml which resides at the root of the application project directory. This file works as an interface between Android OS and your application, so if you do not declare your component in this file, then it will not be considered by the OS. For example, a default manifest file will look like as following file − <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.tutorialspoint7.myapplication"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" 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>
  • 26. The Strings File  The strings.xml file is located in the res/values folder and it contains all the text that your application uses. For example, the names of buttons, labels, default text, and similar types of strings go into this file. This file is responsible for their textual content. For example, a default strings file will look like as following file − <resources> <string name="app_name">HelloWorld</string> <string name="hello_world">Hello world!</string> <string name="menu_settings">Settings</string> <string name="title_activity_main">MainActivity</string> </resources>
  • 27. The Layout File  The activity_main.xml is a layout file available in res/layout directory, that is referenced by your application when building its interface. You will modify this file very frequently to change the layout of your application. For your "Hello World!" application, this file will have following content related to default layout − <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:padding="@dimen/padding_medium" android:text="@string/hello_world" tools:context=".MainActivity" /> </RelativeLayout>
  • 28. Continue……  The TextView is an Android control used to build the GUI and it have various attributes like android:layout_width, android:layout_height etc which are being used to set its width and height etc.. The @string refers to the strings.xml file located in the res/values folder. Hence, @string/hello_world refers to the hello string defined in the strings.xml file, which is "Hello World!".
  • 29. Running the ApplicationRunning the Application To run the app from Android studio, open one of your project's activity files and click Run icon from the tool bar. Android studio installs the app on your AVD and starts it and if everything is fine with your set-up and application, it will display following Emulator window −
  • 30. ….