SlideShare a Scribd company logo
1 of 9
The Greenoid’s GuideTo Building  Android™ Apps [Part–2/6] Android & the Green Robot  are a trademark of Google Inc. http://greenoid.blogspot.com (Oct 2010)
The App Innards http://greenoid.blogspot.com (Oct 2010)
What Goes into an App? Activities Each activity is an Android version of a basic UI block Content Provider You write content providers  to share data of any form residing on the device with other applications Services If you want your code to run always, without any UI elements, services are the answer Intents A notification mechanism for system events like hardware changes, incoming sms … you can also create your own intents to notify others. http://greenoid.blogspot.com (Oct 2010)
Inside An Android Project The Manifest File A declaration of all components inside your application, like activities, services, user permissions, SDK version, and optional libraries in use. XML Layouts You can specify an UI layout in XML and attach it to an activity, giving you freedom to modify the UI without worrying about code. R.java An auto-generated file that connects resources like the XML layout definitions to java code. http://greenoid.blogspot.com (Oct 2010)
Writing an App Thankfully  when you click on New Project in Eclipse the basic skeleton and Manifest file are auto-magically created. The skeleton public class MyActivityextends Activity { @Override     public void onCreate(Bundle icicle) { super.onCreate(icicle); TextViewtv = new TextView(this); setContentView(tv); } } http://greenoid.blogspot.com (Oct 2010)
The Skeleton Explained MyActivity  extends  Activity  Think of the Activity like a high level UI container Public  void  onCreate(Bundle icicle)  Invoked when the activity is created, you might want to create some basic UI widget like a button or TextView here setContentView( TextView ) Since the Activity is a high-level UI container, you will have to call setContentView(button/label) to add your widget to the container If you created a button You will have to do btn.setOnClickListener() to receive events And implement public void onClick(View v) to handle it http://greenoid.blogspot.com (Oct 2010)
The Widget Palette All Widgets extend View TextView - A basic label widget Button - Well, it’s a button ImageView, ImageButton: support for images CheckBox, RadioButton, RadioGroupare a few common UI widgets http://greenoid.blogspot.com (Oct 2010)
Sample Code For the Lazy package com.droid.clockwork; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import java.util.Date; public class MainClock extends Activity { /** Called when the activity is first created. */   public void onCreate(Bundle icicle) { super.onCreate(icicle); TextViewtv = new TextView(this); tv.setText("The Time Now Is: "+new Date().toString()); setContentView(tv);     } } http://greenoid.blogspot.com (Oct 2010)
Coming soon Part 3/6 http://greenoid.blogspot.com (Oct 2010) Meanwhile checkout our blog: http://greenoid.blogspot.com

More Related Content

Similar to Learning Android Part 2/6

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
 
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
 
Android Development project
Android Development projectAndroid Development project
Android Development project
Minhaj Kazi
 

Similar to Learning Android Part 2/6 (20)

Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1
 
Android Homescreen Widgets Demystified
Android Homescreen Widgets DemystifiedAndroid Homescreen Widgets Demystified
Android Homescreen Widgets Demystified
 
Get an Android tutorial for beginners
Get an Android tutorial for beginnersGet an Android tutorial for beginners
Get an Android tutorial for beginners
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
 
Android Development project
Android Development projectAndroid Development project
Android Development project
 
Mobile Application Development With Android
Mobile Application Development With AndroidMobile Application Development With Android
Mobile Application Development With Android
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
UIAutomator
UIAutomatorUIAutomator
UIAutomator
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
Google Android
Google AndroidGoogle Android
Google Android
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android
AndroidAndroid
Android
 
Android
AndroidAndroid
Android
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"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 ...
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Learning Android Part 2/6

  • 1. The Greenoid’s GuideTo Building Android™ Apps [Part–2/6] Android & the Green Robot are a trademark of Google Inc. http://greenoid.blogspot.com (Oct 2010)
  • 2. The App Innards http://greenoid.blogspot.com (Oct 2010)
  • 3. What Goes into an App? Activities Each activity is an Android version of a basic UI block Content Provider You write content providers to share data of any form residing on the device with other applications Services If you want your code to run always, without any UI elements, services are the answer Intents A notification mechanism for system events like hardware changes, incoming sms … you can also create your own intents to notify others. http://greenoid.blogspot.com (Oct 2010)
  • 4. Inside An Android Project The Manifest File A declaration of all components inside your application, like activities, services, user permissions, SDK version, and optional libraries in use. XML Layouts You can specify an UI layout in XML and attach it to an activity, giving you freedom to modify the UI without worrying about code. R.java An auto-generated file that connects resources like the XML layout definitions to java code. http://greenoid.blogspot.com (Oct 2010)
  • 5. Writing an App Thankfully when you click on New Project in Eclipse the basic skeleton and Manifest file are auto-magically created. The skeleton public class MyActivityextends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); TextViewtv = new TextView(this); setContentView(tv); } } http://greenoid.blogspot.com (Oct 2010)
  • 6. The Skeleton Explained MyActivity extends Activity Think of the Activity like a high level UI container Public void onCreate(Bundle icicle) Invoked when the activity is created, you might want to create some basic UI widget like a button or TextView here setContentView( TextView ) Since the Activity is a high-level UI container, you will have to call setContentView(button/label) to add your widget to the container If you created a button You will have to do btn.setOnClickListener() to receive events And implement public void onClick(View v) to handle it http://greenoid.blogspot.com (Oct 2010)
  • 7. The Widget Palette All Widgets extend View TextView - A basic label widget Button - Well, it’s a button ImageView, ImageButton: support for images CheckBox, RadioButton, RadioGroupare a few common UI widgets http://greenoid.blogspot.com (Oct 2010)
  • 8. Sample Code For the Lazy package com.droid.clockwork; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import java.util.Date; public class MainClock extends Activity { /** Called when the activity is first created. */ public void onCreate(Bundle icicle) { super.onCreate(icicle); TextViewtv = new TextView(this); tv.setText("The Time Now Is: "+new Date().toString()); setContentView(tv); } } http://greenoid.blogspot.com (Oct 2010)
  • 9. Coming soon Part 3/6 http://greenoid.blogspot.com (Oct 2010) Meanwhile checkout our blog: http://greenoid.blogspot.com