SlideShare a Scribd company logo
1 of 23
Download to read offline
Android Application
Development Session-1
From Beginner to Advanced
By : Ahesanali Suthar
email: ahesanali.suthar@gmail.com
Topics to be Covered
1.

Introduction of Android.

2.

Android SDK.

3.

Setting Up Development Environment (Windows,Linux).

4.

Creating Project in Eclipse.

5.

Tutorial-1: Hello World

6.

Android Project Directory Structure.
1. Introduction of Android
●

Android is a Linux-based operating system designed primarily for
touchscreen mobile devices such as smartphones and tablet computers,
developed by Google in conjunction with the Open Handset Alliance.

●

Initially developed by Android Inc, whom Google financially backed and
later purchased in 2005.

●

Android has a large community of developers writing applications ("apps")
that extend the functionality of devices, written primarily in a customized
version of Java.They are available for download through Google Play or
third-party sites.

●

The first Android-powered phone was sold in October 2008, and by the
end of 2010 Android had become the world's leading smartphone platform,
overtaking Symbian which held its record for years
2. Android SDK
●

The Android SDK (SDK refers to Software Development KIT)provides you
the API libraries and developer tools necessary to build, test, and debug
apps for Android.

●

Like in windows we have .NET Framework as a SDK for developing the
Softwares for windows platform.Similarly java provide JDK(Java Dev. Kit).
But java provide kit for Linux as well as for windows.

●

To Download SDK: http://developer.android.com/sdk/index.html

●

To know more about Android SDK: http://developer.android.
com/sdk/exploring.html
3. Dev Environment
System Requirements.(OS) (http://developer.android.com/sdk/index.html)
●
●
●

Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
Mac OS X 10.5.8 or later (x86 only)
Linux (tested on Ubuntu Linux, Lucid Lynx)
GNU C Library (glibc) 2.7 or later is required.
On Ubuntu Linux, version 8.04 or later is required.
64-bit distributions must be capable of running 32-bit applications.

Eclipse IDE
●
●
●
●

Eclipse 3.6.2 (Helios) or greate ()
Android SDK
JDK 6 (JRE alone is not sufficient)
Android Development Tools plugin (ADT)
3. Dev Environment (Cont.)
●

After Downloading Android SDK,We have to download platform packages.
3. Dev Environment (Cont.)
●

Once we are done with downloading platform packages either we are
developing on Windows or Linux or Mac we need to install ADT (Android
Development Toolkit) in Eclipse IDE.

To Install ADT into the Eclipse IDE follow below steps.
1. Open Eclipse IDE.
2. Click on Help->Install New Software from the menu bar.
3. Then install window is open then Click on Add Button
3. Dev Environment (Cont.)
●

Now when you click on Add button,you will found below window.

Insert the Name as ADT(any name can be given) and Location of ADT zip file.
Location can be given by clicking on Archive button and then press Ok.
3. Dev Environment (Cont.)
Setting up SDK path into Eclipse IDE
● Open Preferences window by clicking Window -> Preferences.
●

If we have properly installed ADT in Eclipse we have Android option in
Preferences window.

●

As you can see on above image by Clicking on Android in preferences
window we have option available for SDK path.

●

So by clicking Browse button please select android-sdk-window folder
from your computer.so SDK location field have complete path of Android
SDK.So finally you have a setup ready for Android Development.
4.Creating Project in Eclipse
●
●

Open Eclipse IDE.
Click on File->New->Android Project
from file menu.

●

Application Name is the app name that
appears to users. For this project, use "My
First App."
Project Name is the name of your project
directory and the name visible in Eclipse.
Package Name is the package
namespace for your app.
Minimum Required SDK is the lowest
version of Android that your app supports,
indicated using the API level.
Target SDK indicates the highest version
of Android (also using the API level) with
which you have tested with your
application.
Compile With is the platform version
against which you will compile your app.
Click on Next button.

●
●
●

●

●
●
4.Creating Project in Eclipse
●
●
●

The next screen can help you create a launcher icon for your app.Click
Next.
Now you can select an activity template from which to begin building your
app. For this project, select BlankActivity and click Next
Finally click on the Finish.
5.Tutorial-1: Hello World
●

After creating project in eclipse ,run the project by right click on the project
name and Runs As -> Android Application.

●

If simulator is created previously project will run in that other wise it eclipse
will ask for create new simulator.
6.Android Project Directory
Structure.
●

Now we are learning how this hello world is printed
on the screen.

●

Following Image shows android project directory
structure.

●

src: This is the directory where all java files for the
project will reside. In java there is a concept of
package so here files are maintained in packages.
Like in our case there is one package called com.
maktabah which we have entered at the time of
project creation.

●

gen: In this folder the files which are generated by
android-sdk.We are not changing any of the files
here,Because this is the internal reference to sdk.
6.Android Project Directory
Structure.
●

assets: Here resource type information will goes.Like
fonts file,web-pages(when we are developing android
app in HTML5)

●

bin: When are compiling the project all class files are
generated here by java compiler.

●

res: This is important folder we are discussing each
inner directory in detail.

●

drawable-hdpi,drawable-ldpi,drawable-mdpi,
drawable-xhdpi: These are the directories where we
are putting images that are used in projects.
○ But we have question like why these many
directories(4 directories).So the answer is these
are the directory dedicated for different screen
density(in Desktop computer terminology we call
it resolution of the Monitor).
6.Android Project Directory
Structure.
○

●

How android app decide which image to talk
when it is referenced from code we will see it
when we see implementation of the sample
tutorial.

To read more about for these directories please follow
the link:
http://developer.android.
com/guide/practices/screens_support.html

●

Consider following image for example.
6.Android Project Directory
Structure.
i.
ii.
iii.
iv.

xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp

●

layout: This is the directory where we are putting all design
files in xml format.As we can see from right side image
when we create new project default main.xml file is there.

●

These layout xmls files are responsible for the userinterface and look and feel of the app.

●

Like in windows application when we are working in visual
studio IDE we have two files one for design and one for
code.Whenever we place button in design and double click
on it and button_click function in different file and button
User interface is in design file
6.Android Project Directory
Structure.
●

Sample Layout code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
6.Android Project Directory
Structure.
●

values: It contains all xml file for values like styles xml,
string constants and other.

●

As we can see im right side image the when we create a
new android project it only contains string.xml which
contains strings values in xml format for whole project.

●

Strings for lable,error message and titles etc are stored in
string.xml files.We can also write strings at lable in
layout.xml, but it is good practice to declare strings in
string.xml for managing resource in project and
reusability
6.Android Project Directory
Structure.
●

Example of basic string.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelloWorldActivity!</string>
<string name="app_name">HelloWorld</string>
</resources>
6.Android Project Directory
Structure.
AndroidManifest.xml:
●

This is the file where we declaring application components like Activities,
Services,Broadcast-Receivers.

●

Allowing permissions to application

●

We can also call it is a configuration file for the app.
6.Android Project Directory
Structure.
Sample of Manifest for HelloWord App:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.maktabah"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<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>
</application>
</manifest>
Questions ?
Android session 1

More Related Content

What's hot

Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in Background
Ahsanul Karim
 
android layouts
android layoutsandroid layouts
android layouts
Deepa Rani
 
View groups containers
View groups containersView groups containers
View groups containers
Mani Selvaraj
 
Android Development project
Android Development projectAndroid Development project
Android Development project
Minhaj Kazi
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
Ahsanul Karim
 

What's hot (20)

Android Fundamental
Android FundamentalAndroid Fundamental
Android Fundamental
 
Android development module
Android development moduleAndroid development module
Android development module
 
Android application-component
Android application-componentAndroid application-component
Android application-component
 
Ppt 2 android_basics
Ppt 2 android_basicsPpt 2 android_basics
Ppt 2 android_basics
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in Background
 
Android UI Fundamentals part 1
Android UI Fundamentals part 1Android UI Fundamentals part 1
Android UI Fundamentals part 1
 
Android development orientation for starters v4 seminar
Android development orientation for starters v4   seminarAndroid development orientation for starters v4   seminar
Android development orientation for starters v4 seminar
 
Getting started with android studio
Getting started with android studioGetting started with android studio
Getting started with android studio
 
Android
AndroidAndroid
Android
 
android layouts
android layoutsandroid layouts
android layouts
 
What is Android?
What is Android?What is Android?
What is Android?
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample Project
 
Android Development: Build Android App from Scratch
Android Development: Build Android App from ScratchAndroid Development: Build Android App from Scratch
Android Development: Build Android App from Scratch
 
View groups containers
View groups containersView groups containers
View groups containers
 
Android Development project
Android Development projectAndroid Development project
Android Development project
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 

Similar to Android session 1

Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
Ahsanul Karim
 
Android application development
Android application developmentAndroid application development
Android application development
slidesuren
 

Similar to Android session 1 (20)

Introduction to Android and Java.pptx
Introduction to Android and Java.pptxIntroduction to Android and Java.pptx
Introduction to Android and Java.pptx
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development WorkshopJava Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development Workshop
 
ANDROID PPT 1.pdf
ANDROID PPT 1.pdfANDROID PPT 1.pdf
ANDROID PPT 1.pdf
 
Seminar on android app development
Seminar on android app developmentSeminar on android app development
Seminar on android app development
 
Android app development ppt
Android app development pptAndroid app development ppt
Android app development ppt
 
Android Basic
Android BasicAndroid Basic
Android Basic
 
Android
Android Android
Android
 
Android app development lesson 1
Android app development lesson 1Android app development lesson 1
Android app development lesson 1
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
 
Android from A to Z
Android from A to ZAndroid from A to Z
Android from A to Z
 
Android deep dive
Android deep diveAndroid deep dive
Android deep dive
 
Android from A to Z
Android from A to ZAndroid from A to Z
Android from A to Z
 
Internship presentation
Internship presentationInternship presentation
Internship presentation
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
Android application development
Android application developmentAndroid application development
Android application development
 
Android by LAlitha
Android by LAlithaAndroid by LAlitha
Android by LAlitha
 
Google Android
Google AndroidGoogle Android
Google Android
 
Android App Development Overview- HKInfoway Technologies.pdf
Android App Development Overview- HKInfoway Technologies.pdfAndroid App Development Overview- HKInfoway Technologies.pdf
Android App Development Overview- HKInfoway Technologies.pdf
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Android session 1

  • 1. Android Application Development Session-1 From Beginner to Advanced By : Ahesanali Suthar email: ahesanali.suthar@gmail.com
  • 2. Topics to be Covered 1. Introduction of Android. 2. Android SDK. 3. Setting Up Development Environment (Windows,Linux). 4. Creating Project in Eclipse. 5. Tutorial-1: Hello World 6. Android Project Directory Structure.
  • 3. 1. Introduction of Android ● Android is a Linux-based operating system designed primarily for touchscreen mobile devices such as smartphones and tablet computers, developed by Google in conjunction with the Open Handset Alliance. ● Initially developed by Android Inc, whom Google financially backed and later purchased in 2005. ● Android has a large community of developers writing applications ("apps") that extend the functionality of devices, written primarily in a customized version of Java.They are available for download through Google Play or third-party sites. ● The first Android-powered phone was sold in October 2008, and by the end of 2010 Android had become the world's leading smartphone platform, overtaking Symbian which held its record for years
  • 4. 2. Android SDK ● The Android SDK (SDK refers to Software Development KIT)provides you the API libraries and developer tools necessary to build, test, and debug apps for Android. ● Like in windows we have .NET Framework as a SDK for developing the Softwares for windows platform.Similarly java provide JDK(Java Dev. Kit). But java provide kit for Linux as well as for windows. ● To Download SDK: http://developer.android.com/sdk/index.html ● To know more about Android SDK: http://developer.android. com/sdk/exploring.html
  • 5. 3. Dev Environment System Requirements.(OS) (http://developer.android.com/sdk/index.html) ● ● ● Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit) Mac OS X 10.5.8 or later (x86 only) Linux (tested on Ubuntu Linux, Lucid Lynx) GNU C Library (glibc) 2.7 or later is required. On Ubuntu Linux, version 8.04 or later is required. 64-bit distributions must be capable of running 32-bit applications. Eclipse IDE ● ● ● ● Eclipse 3.6.2 (Helios) or greate () Android SDK JDK 6 (JRE alone is not sufficient) Android Development Tools plugin (ADT)
  • 6. 3. Dev Environment (Cont.) ● After Downloading Android SDK,We have to download platform packages.
  • 7. 3. Dev Environment (Cont.) ● Once we are done with downloading platform packages either we are developing on Windows or Linux or Mac we need to install ADT (Android Development Toolkit) in Eclipse IDE. To Install ADT into the Eclipse IDE follow below steps. 1. Open Eclipse IDE. 2. Click on Help->Install New Software from the menu bar. 3. Then install window is open then Click on Add Button
  • 8. 3. Dev Environment (Cont.) ● Now when you click on Add button,you will found below window. Insert the Name as ADT(any name can be given) and Location of ADT zip file. Location can be given by clicking on Archive button and then press Ok.
  • 9. 3. Dev Environment (Cont.) Setting up SDK path into Eclipse IDE ● Open Preferences window by clicking Window -> Preferences. ● If we have properly installed ADT in Eclipse we have Android option in Preferences window. ● As you can see on above image by Clicking on Android in preferences window we have option available for SDK path. ● So by clicking Browse button please select android-sdk-window folder from your computer.so SDK location field have complete path of Android SDK.So finally you have a setup ready for Android Development.
  • 10. 4.Creating Project in Eclipse ● ● Open Eclipse IDE. Click on File->New->Android Project from file menu. ● Application Name is the app name that appears to users. For this project, use "My First App." Project Name is the name of your project directory and the name visible in Eclipse. Package Name is the package namespace for your app. Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application. Compile With is the platform version against which you will compile your app. Click on Next button. ● ● ● ● ● ●
  • 11. 4.Creating Project in Eclipse ● ● ● The next screen can help you create a launcher icon for your app.Click Next. Now you can select an activity template from which to begin building your app. For this project, select BlankActivity and click Next Finally click on the Finish.
  • 12. 5.Tutorial-1: Hello World ● After creating project in eclipse ,run the project by right click on the project name and Runs As -> Android Application. ● If simulator is created previously project will run in that other wise it eclipse will ask for create new simulator.
  • 13. 6.Android Project Directory Structure. ● Now we are learning how this hello world is printed on the screen. ● Following Image shows android project directory structure. ● src: This is the directory where all java files for the project will reside. In java there is a concept of package so here files are maintained in packages. Like in our case there is one package called com. maktabah which we have entered at the time of project creation. ● gen: In this folder the files which are generated by android-sdk.We are not changing any of the files here,Because this is the internal reference to sdk.
  • 14. 6.Android Project Directory Structure. ● assets: Here resource type information will goes.Like fonts file,web-pages(when we are developing android app in HTML5) ● bin: When are compiling the project all class files are generated here by java compiler. ● res: This is important folder we are discussing each inner directory in detail. ● drawable-hdpi,drawable-ldpi,drawable-mdpi, drawable-xhdpi: These are the directories where we are putting images that are used in projects. ○ But we have question like why these many directories(4 directories).So the answer is these are the directory dedicated for different screen density(in Desktop computer terminology we call it resolution of the Monitor).
  • 15. 6.Android Project Directory Structure. ○ ● How android app decide which image to talk when it is referenced from code we will see it when we see implementation of the sample tutorial. To read more about for these directories please follow the link: http://developer.android. com/guide/practices/screens_support.html ● Consider following image for example.
  • 16. 6.Android Project Directory Structure. i. ii. iii. iv. xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp ● layout: This is the directory where we are putting all design files in xml format.As we can see from right side image when we create new project default main.xml file is there. ● These layout xmls files are responsible for the userinterface and look and feel of the app. ● Like in windows application when we are working in visual studio IDE we have two files one for design and one for code.Whenever we place button in design and double click on it and button_click function in different file and button User interface is in design file
  • 17. 6.Android Project Directory Structure. ● Sample Layout code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>
  • 18. 6.Android Project Directory Structure. ● values: It contains all xml file for values like styles xml, string constants and other. ● As we can see im right side image the when we create a new android project it only contains string.xml which contains strings values in xml format for whole project. ● Strings for lable,error message and titles etc are stored in string.xml files.We can also write strings at lable in layout.xml, but it is good practice to declare strings in string.xml for managing resource in project and reusability
  • 19. 6.Android Project Directory Structure. ● Example of basic string.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Hello World, HelloWorldActivity!</string> <string name="app_name">HelloWorld</string> </resources>
  • 20. 6.Android Project Directory Structure. AndroidManifest.xml: ● This is the file where we declaring application components like Activities, Services,Broadcast-Receivers. ● Allowing permissions to application ● We can also call it is a configuration file for the app.
  • 21. 6.Android Project Directory Structure. Sample of Manifest for HelloWord App: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.maktabah" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <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> </application> </manifest>