SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Android Application Architecture
By : NicheTech
info@nichetechsolutions.com
© NicheTech Com. Sol. Pvt. Ltd.
Content
• 2. Android Application Architecture
– 2.1. AndroidManifest.xml
– 2.2. R.java, Resources and Assets
– 2.3. Reference to resources in XML files
– 2.4. Activities and Layouts
– 2.5. Activities and Lifecycle
– 2.6. Context
AndroidManifest.xml
• An Android application is described in the file AndroidManifest.xml.
• This file must declare all Activities, Services, Broadcast
Receivers and Content Provider of the application.
• It must also contain the required permissions for the application.
• For example if the application requires network access it must be
specified here.
• AndroidManifest.xml can be thought as the deployment descriptor for
an Android application.
Back ….
Continue …
Back ….
Continue ...
• The package attribute defines the base package for the following
Java elements.
• It also must be unique as the Android Marketplace only allows
application for a specific package once.
• Therefore a good habit is to use your reverse domain name as a
package to avoid collisions with other developers.
Back ….
Continue …
• android:versionName and android:versionCode specify the
version of your application.
• versionNameis what the user sees and can be any string.
• versionCode must be an integer and the Android Market uses
this to determine if you provided a newer version to trigger the
update on devices which have your application installed.
• You typically start with "1" and increase this value by one if you
roll-out a new version of your application.
Back ….
Continue …
• The tag <activity> defines an Activity, in this example pointing to the
class "de.vogella.android.temperature.Convert".
• An intent filter is registered for this class which defines that
thisActivity is started once the application starts
(action android:name="android.intent.action.MAIN").
• The category definition category
android:name="android.intent.category.LAUNCHER" defines that this
application is added to the application directory on the Android
device.
Back ….
Continue …
• The @string/app_name value refer to resource files which contain the
actual values.
• This makes it easy to provide different resources, e.g. strings, colors,
icons, for different devices and makes it easy to translate
applications.
• The "uses-sdk" part of the "AndroidManifest.xml" defines the minimal
SDK version your application is valid for.
• This will prevent your application being installed on devices with older
SDK versions.
Back ….
Resources
• The directory gen in an Android project contains generated
values.
• R.java is a generated class which contains references to
resources of the res folder in the project.
• These resources are defined in the res directory and can be
values, menus, layouts, icons or pictures or animations.
• For example a resource can be an image or an XML file which
defines strings.
Back ….
R.java, Resources and Assets
Continue …
• If you create a new resource, the corresponding reference is
automatically created in R.java.
• The references are static int values, the Android system provides
methods to access the corresponding resource.
• For example to access a String with the reference
id R.string.yourString use the methodgetString (R.string.yourString));.
• R.java is automatically maintained by the Eclipse development
environment, manual changes are not necessary.
Back ….
Continue …
• While the directory res contains structured values which are known to
the Android platform the directory assetscan be used to store any
kind of data.
• In Java you can access this data via the AssetsManager and the
methodgetAssets().
Back ….
Reference to resources in XML files
• In your XML files, e.g. your layout files you can refer to other
resources via the @ sign.
• For example if you want to refer to a color you defined as resources
you can refer to it via @color/your_id or
• if you have defined a "hello" string as resource you can access it
via @string/hello .
Back ….
Activities and Layouts
• The user interface for Activities is defined via layouts. At
runtime,layouts are instances of android.view.ViewGroups.
• The layout defines the UI elements, their properties and their
arrangement.
• UI elements are based on the class android.view.View .
• ViewGroup is a subclass of the class View and a layout can contain
UI components ( Views ) or other layouts ( ViewGroups ).
Back ….
Continue …
• You should not nestleViewGroups too deeply as this has a negative
impact on performance.
• A layout can be defined via Java code or via XML.
• You typically uses Java code to generate the layout if you don't know
the content until runtime;
• for example if your layout depends on content which you read from
the Internet.
Back ….
Continue …
• XML based layouts are defined via a resource file in the
folder /res/layout .
• This file specifies theViewGroups , Views , their relationship and their
attributes for a specific layout.
• If a UI element needs to be accessed via Java code you have to give
the UI element an unique id via the android:id attribute.
• To assign a new id to an UI element use @+id/yourvalue.
Back ….
Continue …
• By conversion this will create and assign a new id yourvalueto the
corresponding UI element.
• In your Java code you can later access these UI elements via the
methodfindViewById (R.id.yourvalue) .
• Defining layouts via XML is usually the preferred way as this
separates the programming logic from the layout definition.
• It also allows the definition of different layouts for different devices.
• You can also mix both approaches.
Back ….
Activities and Lifecycle
• The operating system controls the life cycle of your application.
• At any time the Android system may stop or destroy your application,
• e.g. because of an incoming call.
• The Android system defines a life cycle for activities via pre-defined
methods.
Back ….
Continue …
• The most important methods are:
• onSaveInstanceState() - called if the activity is stopped. Used to save
data so that the activity can restore its states if re-started
• onPause() - always called if the Activity ends, can be used to release
resource or save data
• onResume() - called if the Activity is re-started, can be used to
initialize fields
Back ….
Continue …
• The activity will also be restarted if a so called "configuration change"
happens.
• A configuration change for example happens if the user changes the
orientation of the device (vertical or horizontal).
• The activity is in this case restarted to enable the Android platform to
load different resources for these configuration,
• e.g. layouts for vertical or horizontal mode. In the emulator you can
simulate the change of the orientation via CNTR+F11.
Back ….
Continue …
• You can avoid a restart of your application for certain configuration
changes via the configChanges attribute on your activity definition in
your AndroidManifest.xml.
• The following activity will not be restarted in case of orientation
changes or position of the physical keyboard (hidden / visible).
Back ….
Context
• The class android.content.Context provides the connections to the
Android system.
• It is the interface to global information about the application
environment.
• Context also provides access to Android Services,
• e.g. theLocation Service.
• As Activities and Services extend the class Context you can directly
access the context viathis.
Back ….

Weitere ähnliche Inhalte

Was ist angesagt?

java code and document security
java code and document securityjava code and document security
java code and document securityAnkit Desai
 
Android Trainning Session 2
Android Trainning  Session 2Android Trainning  Session 2
Android Trainning Session 2Shanmugapriya D
 
Exploiting JXL using Selenium
Exploiting JXL using SeleniumExploiting JXL using Selenium
Exploiting JXL using SeleniumOSSCube
 
Data Persistence in Android with Room Library
Data Persistence in Android with Room LibraryData Persistence in Android with Room Library
Data Persistence in Android with Room LibraryReinvently
 
Android Training Session 1
Android Training Session 1Android Training Session 1
Android Training Session 1Shanmugapriya D
 
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad NicheTech Com. Solutions Pvt. Ltd.
 
Enterprise Spring
Enterprise SpringEnterprise Spring
Enterprise SpringEmprovise
 
Unit vi(dsc++)
Unit vi(dsc++)Unit vi(dsc++)
Unit vi(dsc++)Durga Devi
 
Session 5 Tp5
Session 5 Tp5Session 5 Tp5
Session 5 Tp5phanleson
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.netneeta1995
 

Was ist angesagt? (19)

Weka
WekaWeka
Weka
 
java code and document security
java code and document securityjava code and document security
java code and document security
 
Android Trainning Session 2
Android Trainning  Session 2Android Trainning  Session 2
Android Trainning Session 2
 
Weka
WekaWeka
Weka
 
Exploiting JXL using Selenium
Exploiting JXL using SeleniumExploiting JXL using Selenium
Exploiting JXL using Selenium
 
AAC Room
AAC RoomAAC Room
AAC Room
 
Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
 
Data Persistence in Android with Room Library
Data Persistence in Android with Room LibraryData Persistence in Android with Room Library
Data Persistence in Android with Room Library
 
An Introduction To Weka
An Introduction To WekaAn Introduction To Weka
An Introduction To Weka
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Weka tutorial
Weka tutorialWeka tutorial
Weka tutorial
 
Weka
WekaWeka
Weka
 
Android Training Session 1
Android Training Session 1Android Training Session 1
Android Training Session 1
 
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
 
Enterprise Spring
Enterprise SpringEnterprise Spring
Enterprise Spring
 
Unit vi(dsc++)
Unit vi(dsc++)Unit vi(dsc++)
Unit vi(dsc++)
 
Session 5 Tp5
Session 5 Tp5Session 5 Tp5
Session 5 Tp5
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 

Andere mochten auch

Trek
TrekTrek
Trekgfaux
 
Using Keywords in YouTube Videos and Virtual Tours for Real Estate
Using Keywords in YouTube Videos and Virtual Tours for Real EstateUsing Keywords in YouTube Videos and Virtual Tours for Real Estate
Using Keywords in YouTube Videos and Virtual Tours for Real EstateFlorida Mobile Fusion
 
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...Paul Hunt
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorageKrazy Koder
 
Andromeda: An Android Framework for Sensor-based Applications
Andromeda: An Android Framework for Sensor-based ApplicationsAndromeda: An Android Framework for Sensor-based Applications
Andromeda: An Android Framework for Sensor-based ApplicationsRamon Ribeiro Rabello
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application DevelopmentRamesh Prasad
 
Trace Lessons Learned H4Dip Stanford 2016
Trace Lessons Learned H4Dip Stanford 2016 Trace Lessons Learned H4Dip Stanford 2016
Trace Lessons Learned H4Dip Stanford 2016 Stanford University
 
Aggregate db Lessons Learned H4Dip Stanford 2016
Aggregate db Lessons Learned H4Dip Stanford 2016Aggregate db Lessons Learned H4Dip Stanford 2016
Aggregate db Lessons Learned H4Dip Stanford 2016Stanford University
 
Peacekeeping Lessons Learned H4Dip Stanford 2016
Peacekeeping Lessons Learned H4Dip Stanford 2016Peacekeeping Lessons Learned H4Dip Stanford 2016
Peacekeeping Lessons Learned H4Dip Stanford 2016Stanford University
 
Space Evaders Lessons Learned H4Dip Stanford 2016
Space Evaders Lessons Learned H4Dip Stanford 2016Space Evaders Lessons Learned H4Dip Stanford 2016
Space Evaders Lessons Learned H4Dip Stanford 2016Stanford University
 
Exodus Lessons Learned H4Dip Stanford 2016
Exodus Lessons Learned H4Dip Stanford 2016Exodus Lessons Learned H4Dip Stanford 2016
Exodus Lessons Learned H4Dip Stanford 2016Stanford University
 
Hacking CT Lessons Learned H4Dip Stanford 2016
Hacking CT Lessons Learned H4Dip Stanford 2016Hacking CT Lessons Learned H4Dip Stanford 2016
Hacking CT Lessons Learned H4Dip Stanford 2016Stanford University
 
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016Stanford University
 

Andere mochten auch (13)

Trek
TrekTrek
Trek
 
Using Keywords in YouTube Videos and Virtual Tours for Real Estate
Using Keywords in YouTube Videos and Virtual Tours for Real EstateUsing Keywords in YouTube Videos and Virtual Tours for Real Estate
Using Keywords in YouTube Videos and Virtual Tours for Real Estate
 
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
Creating an FAQ for end users, An evolution of an idea - SharePoint Saturday ...
 
Android datastorage
Android datastorageAndroid datastorage
Android datastorage
 
Andromeda: An Android Framework for Sensor-based Applications
Andromeda: An Android Framework for Sensor-based ApplicationsAndromeda: An Android Framework for Sensor-based Applications
Andromeda: An Android Framework for Sensor-based Applications
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Trace Lessons Learned H4Dip Stanford 2016
Trace Lessons Learned H4Dip Stanford 2016 Trace Lessons Learned H4Dip Stanford 2016
Trace Lessons Learned H4Dip Stanford 2016
 
Aggregate db Lessons Learned H4Dip Stanford 2016
Aggregate db Lessons Learned H4Dip Stanford 2016Aggregate db Lessons Learned H4Dip Stanford 2016
Aggregate db Lessons Learned H4Dip Stanford 2016
 
Peacekeeping Lessons Learned H4Dip Stanford 2016
Peacekeeping Lessons Learned H4Dip Stanford 2016Peacekeeping Lessons Learned H4Dip Stanford 2016
Peacekeeping Lessons Learned H4Dip Stanford 2016
 
Space Evaders Lessons Learned H4Dip Stanford 2016
Space Evaders Lessons Learned H4Dip Stanford 2016Space Evaders Lessons Learned H4Dip Stanford 2016
Space Evaders Lessons Learned H4Dip Stanford 2016
 
Exodus Lessons Learned H4Dip Stanford 2016
Exodus Lessons Learned H4Dip Stanford 2016Exodus Lessons Learned H4Dip Stanford 2016
Exodus Lessons Learned H4Dip Stanford 2016
 
Hacking CT Lessons Learned H4Dip Stanford 2016
Hacking CT Lessons Learned H4Dip Stanford 2016Hacking CT Lessons Learned H4Dip Stanford 2016
Hacking CT Lessons Learned H4Dip Stanford 2016
 
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
 

Ähnlich wie Android Training Ahmedabad , Android Course Ahmedabad, Android architecture

Android project architecture
Android project architectureAndroid project architecture
Android project architectureSourabh Sahu
 
Android Development
Android DevelopmentAndroid Development
Android Developmentmclougm4
 
iOS Application Penetration Testing for Beginners
iOS Application Penetration Testing for BeginnersiOS Application Penetration Testing for Beginners
iOS Application Penetration Testing for BeginnersRyanISI
 
Android Jumpstart Jfokus
Android Jumpstart JfokusAndroid Jumpstart Jfokus
Android Jumpstart JfokusLars Vogel
 
03 android application structure
03 android application structure03 android application structure
03 android application structureSokngim Sa
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1Purvik Rana
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_programEyad Almasri
 
MD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptMD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptbharatt7
 
Interface Programming Android
Interface Programming AndroidInterface Programming Android
Interface Programming AndroidMaksym Davydov
 
Android Studio development model and.pptx
Android Studio development model and.pptxAndroid Studio development model and.pptx
Android Studio development model and.pptxVaibhavKhunger2
 
Introduction to Android (before 2015)
Introduction to Android (before 2015)Introduction to Android (before 2015)
Introduction to Android (before 2015)Chien-Ming Chou
 
Android stepbystep
Android stepbystepAndroid stepbystep
Android stepbystepKrazy Koder
 
Android application development
Android application developmentAndroid application development
Android application developmentslidesuren
 
Android application development fundamentals
Android application development fundamentalsAndroid application development fundamentals
Android application development fundamentalsindiangarg
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101Michael Angelo Rivera
 
Lecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile AppsLecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile AppsMaksym Davydov
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android StudioSuyash Srijan
 
Android introduction
Android introductionAndroid introduction
Android introductionPingLun Liao
 

Ähnlich wie Android Training Ahmedabad , Android Course Ahmedabad, Android architecture (20)

Android project architecture
Android project architectureAndroid project architecture
Android project architecture
 
Android Development
Android DevelopmentAndroid Development
Android Development
 
iOS Application Penetration Testing for Beginners
iOS Application Penetration Testing for BeginnersiOS Application Penetration Testing for Beginners
iOS Application Penetration Testing for Beginners
 
Android Jumpstart Jfokus
Android Jumpstart JfokusAndroid Jumpstart Jfokus
Android Jumpstart Jfokus
 
03 android application structure
03 android application structure03 android application structure
03 android application structure
 
Android Workshop_1
Android Workshop_1Android Workshop_1
Android Workshop_1
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
 
MD-IV-CH-ppt.ppt
MD-IV-CH-ppt.pptMD-IV-CH-ppt.ppt
MD-IV-CH-ppt.ppt
 
Interface Programming Android
Interface Programming AndroidInterface Programming Android
Interface Programming Android
 
Android Studio development model and.pptx
Android Studio development model and.pptxAndroid Studio development model and.pptx
Android Studio development model and.pptx
 
Hello Android
Hello AndroidHello Android
Hello Android
 
Introduction to Android (before 2015)
Introduction to Android (before 2015)Introduction to Android (before 2015)
Introduction to Android (before 2015)
 
Android stepbystep
Android stepbystepAndroid stepbystep
Android stepbystep
 
Androidify workshop
Androidify workshopAndroidify workshop
Androidify workshop
 
Android application development
Android application developmentAndroid application development
Android application development
 
Android application development fundamentals
Android application development fundamentalsAndroid application development fundamentals
Android application development fundamentals
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101
 
Lecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile AppsLecture 05. UI programming for Mobile Apps
Lecture 05. UI programming for Mobile Apps
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
 
Android introduction
Android introductionAndroid introduction
Android introduction
 

Mehr von NicheTech Com. Solutions Pvt. Ltd.

Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes AhmedabadJava Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes AhmedabadNicheTech Com. Solutions Pvt. Ltd.
 
Java Training Ahmedabad , Introduction of java web development
Java Training Ahmedabad , Introduction of java web developmentJava Training Ahmedabad , Introduction of java web development
Java Training Ahmedabad , Introduction of java web developmentNicheTech Com. Solutions Pvt. Ltd.
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...NicheTech Com. Solutions Pvt. Ltd.
 
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course AhmedabadIntroduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course AhmedabadNicheTech Com. Solutions Pvt. Ltd.
 
Android Training Ahmedabad , Android Project Training Ahmedabad, Android Live...
Android Training Ahmedabad , Android Project Training Ahmedabad, Android Live...Android Training Ahmedabad , Android Project Training Ahmedabad, Android Live...
Android Training Ahmedabad , Android Project Training Ahmedabad, Android Live...NicheTech Com. Solutions Pvt. Ltd.
 
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...NicheTech Com. Solutions Pvt. Ltd.
 
Introduction of Oscommerce, PHP Live Project Training Ahmedabad, PHP Course A...
Introduction of Oscommerce, PHP Live Project Training Ahmedabad, PHP Course A...Introduction of Oscommerce, PHP Live Project Training Ahmedabad, PHP Course A...
Introduction of Oscommerce, PHP Live Project Training Ahmedabad, PHP Course A...NicheTech Com. Solutions Pvt. Ltd.
 

Mehr von NicheTech Com. Solutions Pvt. Ltd. (9)

Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes AhmedabadJava Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
Java Training Ahmedabad , how to Insert Data in Servlet, iOS Classes Ahmedabad
 
Java Training Ahmedabad , Introduction of java web development
Java Training Ahmedabad , Introduction of java web developmentJava Training Ahmedabad , Introduction of java web development
Java Training Ahmedabad , Introduction of java web development
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course AhmedabadIntroduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
 
Basic Android
Basic AndroidBasic Android
Basic Android
 
Android Training Ahmedabad , Android Project Training Ahmedabad, Android Live...
Android Training Ahmedabad , Android Project Training Ahmedabad, Android Live...Android Training Ahmedabad , Android Project Training Ahmedabad, Android Live...
Android Training Ahmedabad , Android Project Training Ahmedabad, Android Live...
 
Introduction of Mastert page
Introduction of Mastert pageIntroduction of Mastert page
Introduction of Mastert page
 
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...
Introduction of wordpress, Wordpress Training Ahmedabad, Wordpress Class Ahme...
 
Introduction of Oscommerce, PHP Live Project Training Ahmedabad, PHP Course A...
Introduction of Oscommerce, PHP Live Project Training Ahmedabad, PHP Course A...Introduction of Oscommerce, PHP Live Project Training Ahmedabad, PHP Course A...
Introduction of Oscommerce, PHP Live Project Training Ahmedabad, PHP Course A...
 

Kürzlich hochgeladen

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
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.pdfAdmir Softic
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
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 ClassesCeline George
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
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 17Celine George
 
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 ConsultingTechSoup
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Kürzlich hochgeladen (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet 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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
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
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
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
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 

Android Training Ahmedabad , Android Course Ahmedabad, Android architecture

  • 1. Android Application Architecture By : NicheTech info@nichetechsolutions.com © NicheTech Com. Sol. Pvt. Ltd.
  • 2. Content • 2. Android Application Architecture – 2.1. AndroidManifest.xml – 2.2. R.java, Resources and Assets – 2.3. Reference to resources in XML files – 2.4. Activities and Layouts – 2.5. Activities and Lifecycle – 2.6. Context
  • 3. AndroidManifest.xml • An Android application is described in the file AndroidManifest.xml. • This file must declare all Activities, Services, Broadcast Receivers and Content Provider of the application. • It must also contain the required permissions for the application. • For example if the application requires network access it must be specified here. • AndroidManifest.xml can be thought as the deployment descriptor for an Android application. Back ….
  • 5. Continue ... • The package attribute defines the base package for the following Java elements. • It also must be unique as the Android Marketplace only allows application for a specific package once. • Therefore a good habit is to use your reverse domain name as a package to avoid collisions with other developers. Back ….
  • 6. Continue … • android:versionName and android:versionCode specify the version of your application. • versionNameis what the user sees and can be any string. • versionCode must be an integer and the Android Market uses this to determine if you provided a newer version to trigger the update on devices which have your application installed. • You typically start with "1" and increase this value by one if you roll-out a new version of your application. Back ….
  • 7. Continue … • The tag <activity> defines an Activity, in this example pointing to the class "de.vogella.android.temperature.Convert". • An intent filter is registered for this class which defines that thisActivity is started once the application starts (action android:name="android.intent.action.MAIN"). • The category definition category android:name="android.intent.category.LAUNCHER" defines that this application is added to the application directory on the Android device. Back ….
  • 8. Continue … • The @string/app_name value refer to resource files which contain the actual values. • This makes it easy to provide different resources, e.g. strings, colors, icons, for different devices and makes it easy to translate applications. • The "uses-sdk" part of the "AndroidManifest.xml" defines the minimal SDK version your application is valid for. • This will prevent your application being installed on devices with older SDK versions. Back ….
  • 9. Resources • The directory gen in an Android project contains generated values. • R.java is a generated class which contains references to resources of the res folder in the project. • These resources are defined in the res directory and can be values, menus, layouts, icons or pictures or animations. • For example a resource can be an image or an XML file which defines strings. Back …. R.java, Resources and Assets
  • 10. Continue … • If you create a new resource, the corresponding reference is automatically created in R.java. • The references are static int values, the Android system provides methods to access the corresponding resource. • For example to access a String with the reference id R.string.yourString use the methodgetString (R.string.yourString));. • R.java is automatically maintained by the Eclipse development environment, manual changes are not necessary. Back ….
  • 11. Continue … • While the directory res contains structured values which are known to the Android platform the directory assetscan be used to store any kind of data. • In Java you can access this data via the AssetsManager and the methodgetAssets(). Back ….
  • 12. Reference to resources in XML files • In your XML files, e.g. your layout files you can refer to other resources via the @ sign. • For example if you want to refer to a color you defined as resources you can refer to it via @color/your_id or • if you have defined a "hello" string as resource you can access it via @string/hello . Back ….
  • 13. Activities and Layouts • The user interface for Activities is defined via layouts. At runtime,layouts are instances of android.view.ViewGroups. • The layout defines the UI elements, their properties and their arrangement. • UI elements are based on the class android.view.View . • ViewGroup is a subclass of the class View and a layout can contain UI components ( Views ) or other layouts ( ViewGroups ). Back ….
  • 14. Continue … • You should not nestleViewGroups too deeply as this has a negative impact on performance. • A layout can be defined via Java code or via XML. • You typically uses Java code to generate the layout if you don't know the content until runtime; • for example if your layout depends on content which you read from the Internet. Back ….
  • 15. Continue … • XML based layouts are defined via a resource file in the folder /res/layout . • This file specifies theViewGroups , Views , their relationship and their attributes for a specific layout. • If a UI element needs to be accessed via Java code you have to give the UI element an unique id via the android:id attribute. • To assign a new id to an UI element use @+id/yourvalue. Back ….
  • 16. Continue … • By conversion this will create and assign a new id yourvalueto the corresponding UI element. • In your Java code you can later access these UI elements via the methodfindViewById (R.id.yourvalue) . • Defining layouts via XML is usually the preferred way as this separates the programming logic from the layout definition. • It also allows the definition of different layouts for different devices. • You can also mix both approaches. Back ….
  • 17. Activities and Lifecycle • The operating system controls the life cycle of your application. • At any time the Android system may stop or destroy your application, • e.g. because of an incoming call. • The Android system defines a life cycle for activities via pre-defined methods. Back ….
  • 18. Continue … • The most important methods are: • onSaveInstanceState() - called if the activity is stopped. Used to save data so that the activity can restore its states if re-started • onPause() - always called if the Activity ends, can be used to release resource or save data • onResume() - called if the Activity is re-started, can be used to initialize fields Back ….
  • 19. Continue … • The activity will also be restarted if a so called "configuration change" happens. • A configuration change for example happens if the user changes the orientation of the device (vertical or horizontal). • The activity is in this case restarted to enable the Android platform to load different resources for these configuration, • e.g. layouts for vertical or horizontal mode. In the emulator you can simulate the change of the orientation via CNTR+F11. Back ….
  • 20. Continue … • You can avoid a restart of your application for certain configuration changes via the configChanges attribute on your activity definition in your AndroidManifest.xml. • The following activity will not be restarted in case of orientation changes or position of the physical keyboard (hidden / visible). Back ….
  • 21. Context • The class android.content.Context provides the connections to the Android system. • It is the interface to global information about the application environment. • Context also provides access to Android Services, • e.g. theLocation Service. • As Activities and Services extend the class Context you can directly access the context viathis. Back ….