SlideShare a Scribd company logo
1 of 20
Download to read offline
1
Building
“HelloWorld”
Android Application
Step by Step.
Topics
• Installation and configuration
• Building blocks of Android application
> Activities
> Layout resource files
> AndroidManifest.xml
> Resource files - strings.xml
> R.java
Installation & Configuration
Software Needed
• JDK (Java Development Kit)
> Java programming language is used to build
Android application
• Eclipse IDE
> Editor, Debugger, profiler, deployment
• Android SDK
> Libraries, samples, documentation, handset
emulators, debugger, command line tools
• Eclipse ADT (Android Development Tools) plug-
in
> Give you a powerful, integrated Android
development environment
Creating Android Project using Eclipse
• Automatic creation
building blocks of an
Android application
> Starting Activity
class
> Layout resource file
> AndroidManifest.xml
> strings.xml
> R.java
> Android library
Building Blocks of
Android Application
Building Blocks of Android Application
• Activity classes
• Layout resource files
• Resource files
> strings.xml
• AndroidManifest.xml
• R.java (automatically created from resource
files)
• Android library (automatically configured)
Building Blocks of Android Application
Activity Class
• Each Activity class typically represents a screen
> Like a JSP page in a Web application
• The onCreate() method of Activity class gets
called by the Android system when your
Activity starts
> You create your UI inside the onCreate() method
• Every Activity has to be described in the
AndroidManifest.xml file
• An Activity is typically chosen as a starting one
of your application - like a class that has a
main() method in Java
> Special configuration in AndroidManifest.xml
Activity Class Example
package com.javapassion;
import android.app.Activity;
import android.os.Bundle;
public class HelloWorldActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Create UI using Layout resource file
setContentView(R.layout.main);
}
}
Layout Resource Files
• Every screen has a corresponding layout
resource file
> Unless you create UI programmatically
• Each activity class specifies which layout
resource file to use for each screen it
represents
> Using setContentView(R.layout.main);
• Are located under /res/layout directory
> /res/layout/main.xml layout resource file is
referred to as R.layout.main
Layout Resource File Example
Resource Files - strings.xml
• Let you define the text strings of your
applications in a well-known file
> Rather than in Java code
> Rather than in Layout resource files
• The strings are then referred to through the
names assigned to them
> The mapping is done through R.java
> @string/hello (in the layout resource file)
> R.string.hello (in the Java code)
• Located under /res/values directory
strings.xml Resource File
AndroidManifest.xml file
• Every application must have a manifest file
called AndroidManifest.xml file (with precisely
that name) in its root directory.
• The manifest presents essential information
about the application to the Android system,
information the system must have before it can
run any of the application's code.
Info. in AndroidManifest.xml file
• Java package for the application.
> The package name serves as a unique identifier for
the application.
• Activities
> One activity is designated as a starting Activity
<activity android:name=".HelloWorldActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
AndroidManifest.xml
R.java
• Automatically created by Android system for all
resources defined
R.java
Thank you

More Related Content

What's hot (6)

Using sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add onsUsing sqlite database in android with sqlite manager browser add ons
Using sqlite database in android with sqlite manager browser add ons
 
null Bangalore meet - Php Security
null Bangalore meet - Php Securitynull Bangalore meet - Php Security
null Bangalore meet - Php Security
 
YiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's newYiiConf 2012 - Alexander Makarov - Yii2, what's new
YiiConf 2012 - Alexander Makarov - Yii2, what's new
 
AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)
 
Asp folders and web configurations
Asp folders and web configurationsAsp folders and web configurations
Asp folders and web configurations
 
CakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIsCakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIs
 

Viewers also liked

Presentation on Android application
Presentation on Android applicationPresentation on Android application
Presentation on Android application
Atibur Rahman
 

Viewers also liked (11)

Android studio installation
Android studio installationAndroid studio installation
Android studio installation
 
Chapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and PolymorphismChapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and Polymorphism
 
Polymorphism in java, method overloading and method overriding
Polymorphism in java,  method overloading and method overridingPolymorphism in java,  method overloading and method overriding
Polymorphism in java, method overloading and method overriding
 
JAVA Polymorphism
JAVA PolymorphismJAVA Polymorphism
JAVA Polymorphism
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Static and Dynamic polymorphism in C++
Static and Dynamic polymorphism in C++Static and Dynamic polymorphism in C++
Static and Dynamic polymorphism in C++
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Slideshare android
Slideshare androidSlideshare android
Slideshare android
 
Presentation on Android application
Presentation on Android applicationPresentation on Android application
Presentation on Android application
 
20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles20. Object-Oriented Programming Fundamental Principles
20. Object-Oriented Programming Fundamental Principles
 

Similar to Android stepbystep

Android application development
Android application developmentAndroid application development
Android application development
slidesuren
 
When using Android Studio- what is the purpose of the R-java file- Doe.docx
When using Android Studio- what is the purpose of the R-java file- Doe.docxWhen using Android Studio- what is the purpose of the R-java file- Doe.docx
When using Android Studio- what is the purpose of the R-java file- Doe.docx
SUKHI5
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
aswapnal
 

Similar to Android stepbystep (20)

Android Development
Android DevelopmentAndroid Development
Android Development
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
 
Anatomy of android aplication
Anatomy of android aplicationAnatomy of android aplication
Anatomy of android aplication
 
Android application development
Android application developmentAndroid application development
Android application development
 
Cross-Platform Native Mobile Development with Eclipse
Cross-Platform Native Mobile Development with EclipseCross-Platform Native Mobile Development with Eclipse
Cross-Platform Native Mobile Development with Eclipse
 
Android Training Ahmedabad , Android Course Ahmedabad, Android architecture
Android Training Ahmedabad , Android Course Ahmedabad, Android architectureAndroid Training Ahmedabad , Android Course Ahmedabad, Android architecture
Android Training Ahmedabad , Android Course Ahmedabad, Android architecture
 
Android introduction
Android introductionAndroid introduction
Android introduction
 
When using Android Studio- what is the purpose of the R-java file- Doe.docx
When using Android Studio- what is the purpose of the R-java file- Doe.docxWhen using Android Studio- what is the purpose of the R-java file- Doe.docx
When using Android Studio- what is the purpose of the R-java file- Doe.docx
 
Android app development: a top-down perspective
Android app development: a top-down perspectiveAndroid app development: a top-down perspective
Android app development: a top-down perspective
 
Synapseindia android apps introduction hello world
Synapseindia android apps introduction hello worldSynapseindia android apps introduction hello world
Synapseindia android apps introduction hello world
 
Android application development for TresmaxAsia
Android application development for TresmaxAsiaAndroid application development for TresmaxAsia
Android application development for TresmaxAsia
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1
 
Android programming
Android programmingAndroid programming
Android programming
 
Android Programming.pptx
Android Programming.pptxAndroid Programming.pptx
Android Programming.pptx
 
Dfc 2018 NativeScript
Dfc 2018 NativeScriptDfc 2018 NativeScript
Dfc 2018 NativeScript
 
Android Studio development model and.pptx
Android Studio development model and.pptxAndroid Studio development model and.pptx
Android Studio development model and.pptx
 
Asp.net file types
Asp.net file typesAsp.net file types
Asp.net file types
 
CNIT 128 6. Analyzing Android Applications (Part 1)
CNIT 128 6. Analyzing Android Applications (Part 1)CNIT 128 6. Analyzing Android Applications (Part 1)
CNIT 128 6. Analyzing Android Applications (Part 1)
 
Unit I- ANDROID OVERVIEW.ppt
Unit I- ANDROID OVERVIEW.pptUnit I- ANDROID OVERVIEW.ppt
Unit I- ANDROID OVERVIEW.ppt
 
Android Introduction
Android IntroductionAndroid Introduction
Android Introduction
 

More from Krazy Koder (20)

2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xd
2310 b xd2310 b xd
2310 b xd
 
2310 b xc
2310 b xc2310 b xc
2310 b xc
 
2310 b xb
2310 b xb2310 b xb
2310 b xb
 
2310 b 17
2310 b 172310 b 17
2310 b 17
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 15
2310 b 152310 b 15
2310 b 15
 
2310 b 14
2310 b 142310 b 14
2310 b 14
 
2310 b 13
2310 b 132310 b 13
2310 b 13
 
2310 b 12
2310 b 122310 b 12
2310 b 12
 
2310 b 11
2310 b 112310 b 11
2310 b 11
 
2310 b 10
2310 b 102310 b 10
2310 b 10
 
2310 b 09
2310 b 092310 b 09
2310 b 09
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 08
2310 b 082310 b 08
2310 b 08
 
2310 b 07
2310 b 072310 b 07
2310 b 07
 

Recently uploaded

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 

Android stepbystep

  • 2. Topics • Installation and configuration • Building blocks of Android application > Activities > Layout resource files > AndroidManifest.xml > Resource files - strings.xml > R.java
  • 4. Software Needed • JDK (Java Development Kit) > Java programming language is used to build Android application • Eclipse IDE > Editor, Debugger, profiler, deployment • Android SDK > Libraries, samples, documentation, handset emulators, debugger, command line tools • Eclipse ADT (Android Development Tools) plug- in > Give you a powerful, integrated Android development environment
  • 5. Creating Android Project using Eclipse • Automatic creation building blocks of an Android application > Starting Activity class > Layout resource file > AndroidManifest.xml > strings.xml > R.java > Android library
  • 7. Building Blocks of Android Application • Activity classes • Layout resource files • Resource files > strings.xml • AndroidManifest.xml • R.java (automatically created from resource files) • Android library (automatically configured)
  • 8. Building Blocks of Android Application
  • 9. Activity Class • Each Activity class typically represents a screen > Like a JSP page in a Web application • The onCreate() method of Activity class gets called by the Android system when your Activity starts > You create your UI inside the onCreate() method • Every Activity has to be described in the AndroidManifest.xml file • An Activity is typically chosen as a starting one of your application - like a class that has a main() method in Java > Special configuration in AndroidManifest.xml
  • 10. Activity Class Example package com.javapassion; import android.app.Activity; import android.os.Bundle; public class HelloWorldActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Create UI using Layout resource file setContentView(R.layout.main); } }
  • 11. Layout Resource Files • Every screen has a corresponding layout resource file > Unless you create UI programmatically • Each activity class specifies which layout resource file to use for each screen it represents > Using setContentView(R.layout.main); • Are located under /res/layout directory > /res/layout/main.xml layout resource file is referred to as R.layout.main
  • 13. Resource Files - strings.xml • Let you define the text strings of your applications in a well-known file > Rather than in Java code > Rather than in Layout resource files • The strings are then referred to through the names assigned to them > The mapping is done through R.java > @string/hello (in the layout resource file) > R.string.hello (in the Java code) • Located under /res/values directory
  • 15. AndroidManifest.xml file • Every application must have a manifest file called AndroidManifest.xml file (with precisely that name) in its root directory. • The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code.
  • 16. Info. in AndroidManifest.xml file • Java package for the application. > The package name serves as a unique identifier for the application. • Activities > One activity is designated as a starting Activity <activity android:name=".HelloWorldActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
  • 18. R.java • Automatically created by Android system for all resources defined