SlideShare a Scribd company logo
1 of 30
Download to read offline
Developing Applications
   for Android

    Muhammad Usman Chaudhry
         SZABIST CS4615




                              Lecture # 3
Today
    ● Setting up your development Environment
      ○ Eclipse
      ○ Android SDK
      ○ Android Development Tools (ADT)
    ● Creating HelloWorld Application
    ● File Structure
      ○ AndroidManifest.xml, src, assets, res, bin, gen, etc.
    ● Activity Lifecycle
      ○ onCreate, onStart, onRestart, onResume, onPause,
          onStop, onDestroy
    ● A program to study Lifecycle behavior.



Muhammad Usman Chaudhry       CS4615                        SZABIST
Today
    ● Android Virtual Devices (AVD)
      ○ Creating & Launching Virtual Devices/Emulator
    ● Running applications on Real Device
    ● Debugging
      ○ DDMS
      ○ adb
      ○ Normal debugging
      ○ Using LogCat
    ● Basics About
      ○ View, Fragment, Intent, Content Provider, Service
    ● Learning about VCS, DVCS, Git & Hg.
    ● Using Hg/Bitbucket as version control & how-to, clone,
      pull, commit and push code changes.

Muhammad Usman Chaudhry       CS4615                       SZABIST
Setting Up IDE
    ● Download Eclipse (http://eclipse.org/downloads - Eclipse
      Classic 4.2)
    ● Download & Installing Android SDK (http://developer.
      android.com/sdk)
    ● Configuring Platform APIs (Via SDK Manager)
    ● Installing ADT Plugin (https://dl-ssl.google.
      com/android/eclipse)




Muhammad Usman Chaudhry       CS4615                       SZABIST
Hello World Android
    ● Let's create and discuss HelloWorld
      Application.




Muhammad Usman Chaudhry   CS4615            SZABIST
File Structure
    ● AndroidManifest.xml:
      ○ This file manages, Icons, Labels,
         Permissions, Libraries, Intent Filters and
         many other configuration parameters
         related to application.
      ○ Let's have a look and discuss basics of
         Manifest file in Eclipse.
    ● src:
      ○ Contains all the source packages, activity
         and non-activity Java class files.

Muhammad Usman Chaudhry   CS4615                      SZABIST
File Structure
    ● assets:
      ○ Used to store raw data.
      ○ Example would be textures, game data,
         static html/xml/json files etc.
      ○ Can access via AssetManager
    ● libs: Contain private libraries.
    ● bin: Contain compiled resources. (APK etc.)
    ● gen: Generated Java files. (R.java etc.)
    ● jni: Native code sources, developed using NDK.



Muhammad Usman Chaudhry   CS4615                  SZABIST
File Structure
    ● res:
        ○ Contain all application resources
        ○ Include most of the following directories:
          ■ anim - for xml files that are compiled
             into Animation objects.
          ■ color - for xml files that describe colors.
          ■ drawable - for images, drawable
             resource types like BMP,JPG, 9-patch
             etc. Let's discuss more about drawable
             over Eclipse.

Muhammad Usman Chaudhry     CS4615                   SZABIST
File Structure

             ■ layout - XML files compiled into screen
               objects/views.
             ■ menu - XML files defining application
               menus.
             ■ raw - Same as assets, except it can be
               accessed via R file.
             ■ values - XML files containing string
               values. Let's see how its used.
             ■ xml - Other xml files, eg.
               PreferenceScreen, etc.

Muhammad Usman Chaudhry      CS4615                      SZABIST
Android Activity Lifecycle

    ● Activity instances in our apps transition between various
      states whenever a user interacts with the application.
    ● Mostly these events are called in following order:
       ○ onCreate(Bundle savedInstanceState)
       ○ onStart()
       ○ onResume()
       ○ onPause()
       ○ onRestart()
       ○ onStop()
       ○ onDestroy()
    ● Let's have a look at code in Eclipse and view the diagram
      in next slide.


Muhammad Usman Chaudhry        CS4615                        SZABIST
Android Activity Lifecycle




Muhammad Usman Chaudhry   CS4615   SZABIST
Activity Lifecycle
    ● Let's implement the activity lifecycle on
      Eclipse.




Muhammad Usman Chaudhry   CS4615                  SZABIST
Creating and Managing AVDs
● Let's create AVDs and run our application on
  Virtual Device.




Muhammad Usman Chaudhry   CS4615                 SZABIST
Running on Real Device
● Running our application
● Enabling debugging support




Muhammad Usman Chaudhry   CS4615   SZABIST
Debugging
● Try-It-On-Eclipse:
     ○   Normal Debugging
     ○   Logcat
     ○   DDMS
     ○   adb




Muhammad Usman Chaudhry     CS4615   SZABIST
Let's Discuss About
    ●   View
    ●   Fragment
    ●   Intent
    ●   Content Provider
    ●   Service




Muhammad Usman Chaudhry    CS4615   SZABIST
View
    ● View represents the basic building block for UI components.
    ● All the controls within android are direct or indirect
      subclasses of View.
    ● We may extend View or even its subclasses to create
      custom controls.
    ● Examples are:
       ○ Direct Subclasses:
           ■ ImageView
           ■ TextView
           ■ And many other...
       ○ Indirect Subclasses:
           ■ Button
           ■ ListView
           ■ And many more...
Muhammad Usman Chaudhry        CS4615                         SZABIST
Fragment
    ● A fragment represents a behavior or a
      portion of user interface in an activity.
    ● You may combine multiple fragments in a
      single activity to build a multi-pane UI.
    ● Fragment have lifecycle of its own, but
      we'll study it later.
    ● Fragments are more targeted towards
      tablet applications.
    ● Let's have a look at its design philosophy.

Muhammad Usman Chaudhry   CS4615                    SZABIST
Fragment




Muhammad Usman Chaudhry   CS4615   SZABIST
Intent
    ● More like an 'intention' to do some work.
    ● Intents are used to:
      ○ Broadcast a message
      ○ Start a service
      ○ Launch an activity
      ○ Display a web page
      ○ Dial a phone number
    ● Intents can be explicit or implicit.
    ● Let's have a look at intent.

Muhammad Usman Chaudhry   CS4615                  SZABIST
Content Provider
    ● Standard mechanism to share data among
      applications.
    ● It doesn't expose underlying storage,
      structure and implementation.
    ● Your application can expose data to other
      applications or even read the data shared
      by other applications.



Muhammad Usman Chaudhry   CS4615                  SZABIST
Service
    ● Background processes that runs for long
      time.
    ● Android has 2 type of services:
      ○ Local Services:
         ■ Only used by the application that is hosting it.
      ○ Remote Services:
         ■ Accessible by other applications as well.
    ● Local Vs Remote


Muhammad Usman Chaudhry       CS4615                      SZABIST
What's Version Control & Why We Need It?

    ● Version control is the management of
      changes to the source files.
    ● It's used to keep track of who did what and
      when in the code.
    ● In case of problem in latest code, you can
      easily revert back to any past version.
    ● Easier to collaborate and track the code
      changes among programmers working on
      the same project and files.

Muhammad Usman Chaudhry   CS4615                SZABIST
Standard Version Control System

    ● Usually a central server.
    ● A programmer may check-out a file, work
      over it and checks-in back.
    ● When a programmer has checked the file
      out, no other programmers can make
      changes to that particular file.
    ● Famous framework is SVN, CVS etc.



Muhammad Usman Chaudhry   CS4615                SZABIST
DVCS
    Distributed Version Control System

    ● Instead of centralized system it uses P2P.
    ● Avoids single point of failure.
    ● Allow users to check-in and merge the code
      anytime they want to.
    ● Famous frameworks are Hg(Mercurial) and
      Git.
    ● Let's watch this video to get more detailed
      idea:
      ○ http://www.fogcreek.com/kiln/

Muhammad Usman Chaudhry   CS4615               SZABIST
Mercurial & Git
    ● Mercurial (Hg) & Git are 2 leading
      frameworks used for Revision Control.
    ● Basic difference is,
         ○ git provide set of tools like git-pull, git-push, etc.
         ○ Hg is monolithic and all in one.
    ● Both have almost identical features.
    ● We prefer Mercurial, due to easier learning
      curve.



Muhammad Usman Chaudhry          CS4615                         SZABIST
Using Hg & BB
    ● Installing Hg
    ● Let's create a repository at Bitbucket (BB) Source
      code hosting site.
    ● Create a local repository. (hg init)
    ● Add Files. (hg add .)
    ● Commit changes (hg commit -m "first")
    ● Push our changes to BB. (hg push REPO-URL)
    ● Remember repeat cycle
      ○ Pull - Update - Merge/Resolve - Commit - Push
    ● Adding users to BB & using (hg clone to get current
      copy).
    ● We shall look into branching etc. later.
Muhammad Usman Chaudhry      CS4615                     SZABIST
Lab Tasks Today
    ● Setup Android Development Environment
    ● Create HelloWorld Application
    ● Create AVDs
    ● Run your application in at least 2 different
      AVDs
    ● Create Lifecycle Activity Application
    ● Log all lifecycle events



Muhammad Usman Chaudhry   CS4615                 SZABIST
Lab Tasks Today
    ● Setup Hg on System, create Bitbucket account.
    ● Create a group of 2, invite your partner so he/she
      could clone the code, make changes and pass
      through the following Steps:
      ○ init-add-commit-push (For you)
      ○ clone (For other group partner)
      ○ //Make certain changes
      ○ pull-update-commit-push (For other group
         partner)
      ○ //Make certain changes
      ○ pull-update-commit-push (For you)

Muhammad Usman Chaudhry      CS4615                        SZABIST
Coming Up Next
    ● Detail in Design!
    ● We'll learn to use all the controls.




Muhammad Usman Chaudhry       CS4615         SZABIST

More Related Content

Similar to Developing Applications for Android - Lecture#3

The Ultimate Android Security Checklist (Mdevcon 2014)
The Ultimate Android Security Checklist (Mdevcon 2014)The Ultimate Android Security Checklist (Mdevcon 2014)
The Ultimate Android Security Checklist (Mdevcon 2014)Ron Munitz
 
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)Ron Munitz
 
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...niallo
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JSFestUA
 
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015Codemotion
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendVlad Fedosov
 
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)Ron Munitz
 
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
Voxxed days Vilnius 2015 - Android Reverse Engineering LabVoxxed days Vilnius 2015 - Android Reverse Engineering Lab
Voxxed days Vilnius 2015 - Android Reverse Engineering LabRon Munitz
 
Leveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVOpersys inc.
 
CodeMotion tel aviv 2015 - android reverse engineering lab
CodeMotion tel aviv 2015 - android reverse engineering labCodeMotion tel aviv 2015 - android reverse engineering lab
CodeMotion tel aviv 2015 - android reverse engineering labRon Munitz
 
Progressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioProgressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioKnoldus Inc.
 
Secure Developer Access at Decisiv
Secure Developer Access at DecisivSecure Developer Access at Decisiv
Secure Developer Access at DecisivTeleport
 
Pentester++
Pentester++Pentester++
Pentester++CTruncer
 
Getting started with docker (2017)
Getting started with docker (2017)Getting started with docker (2017)
Getting started with docker (2017)JEMLI Fathi
 
MobSecCon 2015 - Burning Marshmallows
MobSecCon 2015 - Burning Marshmallows MobSecCon 2015 - Burning Marshmallows
MobSecCon 2015 - Burning Marshmallows Ron Munitz
 
Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Opersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Headless Android (Wearable DevCon 2014)
Headless Android (Wearable DevCon 2014)Headless Android (Wearable DevCon 2014)
Headless Android (Wearable DevCon 2014)Ron Munitz
 

Similar to Developing Applications for Android - Lecture#3 (20)

The Ultimate Android Security Checklist (Mdevcon 2014)
The Ultimate Android Security Checklist (Mdevcon 2014)The Ultimate Android Security Checklist (Mdevcon 2014)
The Ultimate Android Security Checklist (Mdevcon 2014)
 
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
 
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
Continuous Deployment of Front-end JavaScript with StriderCD, Github and Sauc...
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
Ron Munitz - The Ultimate Android Security Checklist - Codemotion Rome 2015
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
 
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
The Ultimate Android Security Checklist (Codemotion Tel-Aviv, 2014)
 
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
Voxxed days Vilnius 2015 - Android Reverse Engineering LabVoxxed days Vilnius 2015 - Android Reverse Engineering Lab
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
 
Leveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IV
 
CodeMotion tel aviv 2015 - android reverse engineering lab
CodeMotion tel aviv 2015 - android reverse engineering labCodeMotion tel aviv 2015 - android reverse engineering lab
CodeMotion tel aviv 2015 - android reverse engineering lab
 
Progressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioProgressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.io
 
Secure Developer Access at Decisiv
Secure Developer Access at DecisivSecure Developer Access at Decisiv
Secure Developer Access at Decisiv
 
Pentester++
Pentester++Pentester++
Pentester++
 
Getting started with docker (2017)
Getting started with docker (2017)Getting started with docker (2017)
Getting started with docker (2017)
 
MobSecCon 2015 - Burning Marshmallows
MobSecCon 2015 - Burning Marshmallows MobSecCon 2015 - Burning Marshmallows
MobSecCon 2015 - Burning Marshmallows
 
Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3
 
Headless Android
Headless AndroidHeadless Android
Headless Android
 
Drools & jBPM Workshop Barcelona 2013
Drools & jBPM Workshop  Barcelona 2013Drools & jBPM Workshop  Barcelona 2013
Drools & jBPM Workshop Barcelona 2013
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Headless Android (Wearable DevCon 2014)
Headless Android (Wearable DevCon 2014)Headless Android (Wearable DevCon 2014)
Headless Android (Wearable DevCon 2014)
 

Recently uploaded

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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 RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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...Martijn de Jong
 
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...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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...DianaGray10
 
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 DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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 FresherRemote DBA Services
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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...
 
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...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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...
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 

Developing Applications for Android - Lecture#3

  • 1. Developing Applications for Android Muhammad Usman Chaudhry SZABIST CS4615 Lecture # 3
  • 2. Today ● Setting up your development Environment ○ Eclipse ○ Android SDK ○ Android Development Tools (ADT) ● Creating HelloWorld Application ● File Structure ○ AndroidManifest.xml, src, assets, res, bin, gen, etc. ● Activity Lifecycle ○ onCreate, onStart, onRestart, onResume, onPause, onStop, onDestroy ● A program to study Lifecycle behavior. Muhammad Usman Chaudhry CS4615 SZABIST
  • 3. Today ● Android Virtual Devices (AVD) ○ Creating & Launching Virtual Devices/Emulator ● Running applications on Real Device ● Debugging ○ DDMS ○ adb ○ Normal debugging ○ Using LogCat ● Basics About ○ View, Fragment, Intent, Content Provider, Service ● Learning about VCS, DVCS, Git & Hg. ● Using Hg/Bitbucket as version control & how-to, clone, pull, commit and push code changes. Muhammad Usman Chaudhry CS4615 SZABIST
  • 4. Setting Up IDE ● Download Eclipse (http://eclipse.org/downloads - Eclipse Classic 4.2) ● Download & Installing Android SDK (http://developer. android.com/sdk) ● Configuring Platform APIs (Via SDK Manager) ● Installing ADT Plugin (https://dl-ssl.google. com/android/eclipse) Muhammad Usman Chaudhry CS4615 SZABIST
  • 5. Hello World Android ● Let's create and discuss HelloWorld Application. Muhammad Usman Chaudhry CS4615 SZABIST
  • 6. File Structure ● AndroidManifest.xml: ○ This file manages, Icons, Labels, Permissions, Libraries, Intent Filters and many other configuration parameters related to application. ○ Let's have a look and discuss basics of Manifest file in Eclipse. ● src: ○ Contains all the source packages, activity and non-activity Java class files. Muhammad Usman Chaudhry CS4615 SZABIST
  • 7. File Structure ● assets: ○ Used to store raw data. ○ Example would be textures, game data, static html/xml/json files etc. ○ Can access via AssetManager ● libs: Contain private libraries. ● bin: Contain compiled resources. (APK etc.) ● gen: Generated Java files. (R.java etc.) ● jni: Native code sources, developed using NDK. Muhammad Usman Chaudhry CS4615 SZABIST
  • 8. File Structure ● res: ○ Contain all application resources ○ Include most of the following directories: ■ anim - for xml files that are compiled into Animation objects. ■ color - for xml files that describe colors. ■ drawable - for images, drawable resource types like BMP,JPG, 9-patch etc. Let's discuss more about drawable over Eclipse. Muhammad Usman Chaudhry CS4615 SZABIST
  • 9. File Structure ■ layout - XML files compiled into screen objects/views. ■ menu - XML files defining application menus. ■ raw - Same as assets, except it can be accessed via R file. ■ values - XML files containing string values. Let's see how its used. ■ xml - Other xml files, eg. PreferenceScreen, etc. Muhammad Usman Chaudhry CS4615 SZABIST
  • 10. Android Activity Lifecycle ● Activity instances in our apps transition between various states whenever a user interacts with the application. ● Mostly these events are called in following order: ○ onCreate(Bundle savedInstanceState) ○ onStart() ○ onResume() ○ onPause() ○ onRestart() ○ onStop() ○ onDestroy() ● Let's have a look at code in Eclipse and view the diagram in next slide. Muhammad Usman Chaudhry CS4615 SZABIST
  • 11. Android Activity Lifecycle Muhammad Usman Chaudhry CS4615 SZABIST
  • 12. Activity Lifecycle ● Let's implement the activity lifecycle on Eclipse. Muhammad Usman Chaudhry CS4615 SZABIST
  • 13. Creating and Managing AVDs ● Let's create AVDs and run our application on Virtual Device. Muhammad Usman Chaudhry CS4615 SZABIST
  • 14. Running on Real Device ● Running our application ● Enabling debugging support Muhammad Usman Chaudhry CS4615 SZABIST
  • 15. Debugging ● Try-It-On-Eclipse: ○ Normal Debugging ○ Logcat ○ DDMS ○ adb Muhammad Usman Chaudhry CS4615 SZABIST
  • 16. Let's Discuss About ● View ● Fragment ● Intent ● Content Provider ● Service Muhammad Usman Chaudhry CS4615 SZABIST
  • 17. View ● View represents the basic building block for UI components. ● All the controls within android are direct or indirect subclasses of View. ● We may extend View or even its subclasses to create custom controls. ● Examples are: ○ Direct Subclasses: ■ ImageView ■ TextView ■ And many other... ○ Indirect Subclasses: ■ Button ■ ListView ■ And many more... Muhammad Usman Chaudhry CS4615 SZABIST
  • 18. Fragment ● A fragment represents a behavior or a portion of user interface in an activity. ● You may combine multiple fragments in a single activity to build a multi-pane UI. ● Fragment have lifecycle of its own, but we'll study it later. ● Fragments are more targeted towards tablet applications. ● Let's have a look at its design philosophy. Muhammad Usman Chaudhry CS4615 SZABIST
  • 20. Intent ● More like an 'intention' to do some work. ● Intents are used to: ○ Broadcast a message ○ Start a service ○ Launch an activity ○ Display a web page ○ Dial a phone number ● Intents can be explicit or implicit. ● Let's have a look at intent. Muhammad Usman Chaudhry CS4615 SZABIST
  • 21. Content Provider ● Standard mechanism to share data among applications. ● It doesn't expose underlying storage, structure and implementation. ● Your application can expose data to other applications or even read the data shared by other applications. Muhammad Usman Chaudhry CS4615 SZABIST
  • 22. Service ● Background processes that runs for long time. ● Android has 2 type of services: ○ Local Services: ■ Only used by the application that is hosting it. ○ Remote Services: ■ Accessible by other applications as well. ● Local Vs Remote Muhammad Usman Chaudhry CS4615 SZABIST
  • 23. What's Version Control & Why We Need It? ● Version control is the management of changes to the source files. ● It's used to keep track of who did what and when in the code. ● In case of problem in latest code, you can easily revert back to any past version. ● Easier to collaborate and track the code changes among programmers working on the same project and files. Muhammad Usman Chaudhry CS4615 SZABIST
  • 24. Standard Version Control System ● Usually a central server. ● A programmer may check-out a file, work over it and checks-in back. ● When a programmer has checked the file out, no other programmers can make changes to that particular file. ● Famous framework is SVN, CVS etc. Muhammad Usman Chaudhry CS4615 SZABIST
  • 25. DVCS Distributed Version Control System ● Instead of centralized system it uses P2P. ● Avoids single point of failure. ● Allow users to check-in and merge the code anytime they want to. ● Famous frameworks are Hg(Mercurial) and Git. ● Let's watch this video to get more detailed idea: ○ http://www.fogcreek.com/kiln/ Muhammad Usman Chaudhry CS4615 SZABIST
  • 26. Mercurial & Git ● Mercurial (Hg) & Git are 2 leading frameworks used for Revision Control. ● Basic difference is, ○ git provide set of tools like git-pull, git-push, etc. ○ Hg is monolithic and all in one. ● Both have almost identical features. ● We prefer Mercurial, due to easier learning curve. Muhammad Usman Chaudhry CS4615 SZABIST
  • 27. Using Hg & BB ● Installing Hg ● Let's create a repository at Bitbucket (BB) Source code hosting site. ● Create a local repository. (hg init) ● Add Files. (hg add .) ● Commit changes (hg commit -m "first") ● Push our changes to BB. (hg push REPO-URL) ● Remember repeat cycle ○ Pull - Update - Merge/Resolve - Commit - Push ● Adding users to BB & using (hg clone to get current copy). ● We shall look into branching etc. later. Muhammad Usman Chaudhry CS4615 SZABIST
  • 28. Lab Tasks Today ● Setup Android Development Environment ● Create HelloWorld Application ● Create AVDs ● Run your application in at least 2 different AVDs ● Create Lifecycle Activity Application ● Log all lifecycle events Muhammad Usman Chaudhry CS4615 SZABIST
  • 29. Lab Tasks Today ● Setup Hg on System, create Bitbucket account. ● Create a group of 2, invite your partner so he/she could clone the code, make changes and pass through the following Steps: ○ init-add-commit-push (For you) ○ clone (For other group partner) ○ //Make certain changes ○ pull-update-commit-push (For other group partner) ○ //Make certain changes ○ pull-update-commit-push (For you) Muhammad Usman Chaudhry CS4615 SZABIST
  • 30. Coming Up Next ● Detail in Design! ● We'll learn to use all the controls. Muhammad Usman Chaudhry CS4615 SZABIST