SlideShare una empresa de Scribd logo
1 de 16
ANDROID 세미나
FOR BEGINNER (2)
     PoolC 홍철주
     2012. 4. 18
RESOURCE -> SOURCE CODE
  <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" >

      <TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello" />

      <Button
          android:id="@+id/button1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Button" />

  </LinearLayout>
RESOURCE -> SOURCE CODE
RESOURCE -> SOURCE CODE

  public class TestActivity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);

          Button mButton = (Button)findViewById(R.id.button1);
      }
  }
RESOURCE -> SOURCE CODE
  public final class R {
      public static final class attr {
      }
      public static final class drawable {
          public static final int ic_launcher=0x7f020000;
      }
      public static final class id {
          public static final int button1=0x7f050000;
      }
      public static final class layout {
          public static final int main=0x7f030000;
      }
      public static final class string {
          public static final int app_name=0x7f040001;
          public static final int hello=0x7f040000;
      }
  }
RESOURCE -> SOURCE CODE


 {ResourceType} {Varible} = (ResourceType)findViewById(ResourceAddress);
RESOURCE -> SOURCE CODE
        Button mButton = (Button)findViewById(R.id.button1);

        // Button Listener : onClick -> call a function
        mButton.setOnClickListener(new Button.OnClickListener(){

 	 	 	 public void onClick(View v) {
 	 	 	 	 // TODO Auto-generated method stub
 	 	 	 	 Toast.makeText(getApplicationContext(), "Hello, World",
 Toast.LENGTH_SHORT).show();
 	 	 	 }
         });
ACTIVITY


• 일단은   보이는 화면이라고 생각

• 당신은   화면 위에다가 터치도 하고 이것 저것한다

 • 입력도   받고 출력도 받고

• 액티비티   주기를 볼 필요가 있긴 한데...
INTENT


• 안드로이드에서의       의사표현 수단

• 어떤   component를 부른다!

• 그리고   무엇을 해달라고 요청!
CONTEXT


• 어플리케이션    환경의 전역 정보에 접근하기 위한 인터
페이스

• 시스템   정보 접근, API 호출

• 액티비티간    리소스 공유 등..
INTENT -> NEW ACTIVITY!


	   Intent mIntent = new Intent(TestActivity.this, SecondActivity.class);
	   	 	 	 startActivity(mIntent);
	   	 	

                 Intent 의 생성자는 여러가지.
                        이는 그 중 하나.
SIMPLE CALCULATOR


                op1
opr
                op2


                result
SIMPLE CALCULATOR


   	   EditText op1, op2;
   	   TextView opr, result;
   	   Button plus, minus, mul, div;
SIMPLE CALCULATOR
               public void onCreate(Bundle savedInstanceState) {
                      super.onCreate(savedInstanceState);
                      setContentView(R.layout.main);

                      op1 = (EditText)findViewById(R.id.op1);
                      op2 = (EditText)findViewById(R.id.op2);
                      opr = (TextView)findViewById(R.id.opr);
                      result = (TextView)findViewById(R.id.result);

                      plus = (Button)findViewById(R.id.plus);
                      plus.setOnClickListener(this);
                      minus = (Button)findViewById(R.id.minus);
                      minus.setOnClickListener(this);
                      mul = (Button)findViewById(R.id.mul);
                      mul.setOnClickListener(this);
                      div = (Button)findViewById(R.id.div);
                      div.setOnClickListener(this);

                  }
                                      this? -> activity
public class TestActivity extends Activity implements View.OnClickListener
SIMPLE CALCULATOR
  public   void onClick(View v) {
  	 	      // TODO Auto-generated method stub
  	 	      switch(v.getId()) {
  	 	      case R.id.plus:
  	 	      	 process(Operator.plus);
  	 	      	 break;
  	 	      case R.id.minus:
  	 	      	 process(Operator.minus);
  	 	      	 break;
  	 	      case R.id.mul:
  	 	      	 process(Operator.mul);
  	 	      	 break;
  	 	      case R.id.div:
  	 	      	 process(Operator.div);
  	 	      	 break;
  	 	      }
  	 }
SIMPLE CALCULATOR
void process(Operator op)
	   {
	   	  int op1Num = Integer.parseInt(op1.getText().toString());
	   	  int op2Num = Integer.parseInt(op2.getText().toString());
	   	  double resultNum = 0;
	   	
	   	  switch(op)
	   	  {
	   	  case plus:
	   	  	   resultNum = op1Num + op2Num;
	   	  	   opr.setText("+");
	   	  	   break;
	   	  case minus:
	   	  	   resultNum = op1Num - op2Num;
	   	  	   opr.setText("-");
	   	  	   break;
	   	  case mul:
	   	  	   resultNum = op1Num * op2Num;
	   	  	   opr.setText("*");
	   	  	   break;
	   	  case div:
	   	  	   resultNum = (double)op1Num / op2Num;
	   	  	   opr.setText("/");
	   	  	   break;
	   	  }
	   	
	   	  result.setText(Double.toString(resultNum));

Más contenido relacionado

La actualidad más candente

VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
Understanding Functions and "this" in the World of ES2017+
Understanding Functions and "this" in the World of ES2017+Understanding Functions and "this" in the World of ES2017+
Understanding Functions and "this" in the World of ES2017+Bryan Hughes
 
Business Rules with Brick
Business Rules with BrickBusiness Rules with Brick
Business Rules with Brickbrian d foy
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access RunbookTaha Shakeel
 
Strategies for Mitigating Complexity in React Based Redux Applicaitons
Strategies for Mitigating Complexity in React Based Redux ApplicaitonsStrategies for Mitigating Complexity in React Based Redux Applicaitons
Strategies for Mitigating Complexity in React Based Redux Applicaitonsgarbles
 
Zend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency InjectionZend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency InjectionAbdul Malik Ikhsan
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Eyal Vardi
 
Intro to Advanced JavaScript
Intro to Advanced JavaScriptIntro to Advanced JavaScript
Intro to Advanced JavaScriptryanstout
 
What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)Arnaud Langlade
 
Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Rafael Felix da Silva
 
Jqeury ajax plugins
Jqeury ajax pluginsJqeury ajax plugins
Jqeury ajax pluginsInbal Geffen
 
Authentication Functions
Authentication FunctionsAuthentication Functions
Authentication FunctionsValerie Rickert
 

La actualidad más candente (16)

VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
Understanding Functions and "this" in the World of ES2017+
Understanding Functions and "this" in the World of ES2017+Understanding Functions and "this" in the World of ES2017+
Understanding Functions and "this" in the World of ES2017+
 
Business Rules with Brick
Business Rules with BrickBusiness Rules with Brick
Business Rules with Brick
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access Runbook
 
5. CodeIgniter copy1
5. CodeIgniter copy15. CodeIgniter copy1
5. CodeIgniter copy1
 
Strategies for Mitigating Complexity in React Based Redux Applicaitons
Strategies for Mitigating Complexity in React Based Redux ApplicaitonsStrategies for Mitigating Complexity in React Based Redux Applicaitons
Strategies for Mitigating Complexity in React Based Redux Applicaitons
 
Zend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency InjectionZend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency Injection
 
Javascript - Beyond-jQuery
Javascript - Beyond-jQueryJavascript - Beyond-jQuery
Javascript - Beyond-jQuery
 
My Development Story
My Development StoryMy Development Story
My Development Story
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
Intro to Advanced JavaScript
Intro to Advanced JavaScriptIntro to Advanced JavaScript
Intro to Advanced JavaScript
 
What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)
 
Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012Desenvolvendo APIs usando Rails - Guru SC 2012
Desenvolvendo APIs usando Rails - Guru SC 2012
 
culadora cientifica en java
culadora cientifica en javaculadora cientifica en java
culadora cientifica en java
 
Jqeury ajax plugins
Jqeury ajax pluginsJqeury ajax plugins
Jqeury ajax plugins
 
Authentication Functions
Authentication FunctionsAuthentication Functions
Authentication Functions
 

Destacado

リーンスタートアップ2012‐2
リーンスタートアップ2012‐2リーンスタートアップ2012‐2
リーンスタートアップ2012‐2Masaki Yoshida
 
Using Facebook For Your Business
Using Facebook For Your BusinessUsing Facebook For Your Business
Using Facebook For Your BusinessOCG PR
 
Are Your Ready for Your Next Formulary Win?
Are Your Ready for Your Next Formulary Win?Are Your Ready for Your Next Formulary Win?
Are Your Ready for Your Next Formulary Win?PaulLukas
 
Toplanti yonetimi-ozel-dersi
Toplanti yonetimi-ozel-dersiToplanti yonetimi-ozel-dersi
Toplanti yonetimi-ozel-dersizeynep_zyn85
 
Truzim meslek-lisesi
Truzim meslek-lisesiTruzim meslek-lisesi
Truzim meslek-lisesizeynep_zyn85
 
دراسة الخصائص التصميمية للفراغات العمرانية الخاصة بالاحياء السكنية
دراسة الخصائص التصميمية للفراغات العمرانية الخاصة بالاحياء السكنيةدراسة الخصائص التصميمية للفراغات العمرانية الخاصة بالاحياء السكنية
دراسة الخصائص التصميمية للفراغات العمرانية الخاصة بالاحياء السكنية engmohamed_architect
 

Destacado (11)

Figurative language
Figurative languageFigurative language
Figurative language
 
Tours in Mexico
Tours in MexicoTours in Mexico
Tours in Mexico
 
リーンスタートアップ2012‐2
リーンスタートアップ2012‐2リーンスタートアップ2012‐2
リーンスタートアップ2012‐2
 
Using Facebook For Your Business
Using Facebook For Your BusinessUsing Facebook For Your Business
Using Facebook For Your Business
 
Presentation1
Presentation1Presentation1
Presentation1
 
Contaminación
ContaminaciónContaminación
Contaminación
 
Are Your Ready for Your Next Formulary Win?
Are Your Ready for Your Next Formulary Win?Are Your Ready for Your Next Formulary Win?
Are Your Ready for Your Next Formulary Win?
 
Toplanti yonetimi-ozel-dersi
Toplanti yonetimi-ozel-dersiToplanti yonetimi-ozel-dersi
Toplanti yonetimi-ozel-dersi
 
Truzim meslek-lisesi
Truzim meslek-lisesiTruzim meslek-lisesi
Truzim meslek-lisesi
 
Trakya edu
Trakya eduTrakya edu
Trakya edu
 
دراسة الخصائص التصميمية للفراغات العمرانية الخاصة بالاحياء السكنية
دراسة الخصائص التصميمية للفراغات العمرانية الخاصة بالاحياء السكنيةدراسة الخصائص التصميمية للفراغات العمرانية الخاصة بالاحياء السكنية
دراسة الخصائص التصميمية للفراغات العمرانية الخاصة بالاحياء السكنية
 

Similar a 안드로이드 세미나 2

Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intentadmin220812
 
Quick Intro to Android Development
Quick Intro to Android DevelopmentQuick Intro to Android Development
Quick Intro to Android DevelopmentJussi Pohjolainen
 
Android Location-based應用開發分享
Android Location-based應用開發分享Android Location-based應用開發分享
Android Location-based應用開發分享koji lin
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversUtkarsh Mankad
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your appsJuan C Catalan
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Integrating React.js with PHP projects
Integrating React.js with PHP projectsIntegrating React.js with PHP projects
Integrating React.js with PHP projectsIgnacio Martín
 
Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Eric Hogue
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & IntentsLope Emano
 
Saindo da zona de conforto… resolvi aprender android
Saindo da zona de conforto… resolvi aprender androidSaindo da zona de conforto… resolvi aprender android
Saindo da zona de conforto… resolvi aprender androidDaniel Baccin
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)Jose Manuel Pereira Garcia
 

Similar a 안드로이드 세미나 2 (20)

Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intent
 
Quick Intro to Android Development
Quick Intro to Android DevelopmentQuick Intro to Android Development
Quick Intro to Android Development
 
Day 5
Day 5Day 5
Day 5
 
Android Location-based應用開發分享
Android Location-based應用開發分享Android Location-based應用開發分享
Android Location-based應用開發分享
 
20 Codigos
20 Codigos20 Codigos
20 Codigos
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Android 3
Android 3Android 3
Android 3
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your apps
 
Practical
PracticalPractical
Practical
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Minicurso Android
Minicurso AndroidMinicurso Android
Minicurso Android
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Integrating React.js with PHP projects
Integrating React.js with PHP projectsIntegrating React.js with PHP projects
Integrating React.js with PHP projects
 
Action bar
Action barAction bar
Action bar
 
Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
 
Saindo da zona de conforto… resolvi aprender android
Saindo da zona de conforto… resolvi aprender androidSaindo da zona de conforto… resolvi aprender android
Saindo da zona de conforto… resolvi aprender android
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 
HNUH
HNUHHNUH
HNUH
 
20 codigos
20 codigos20 codigos
20 codigos
 

Último

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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 connectorsNanddeep Nachan
 
"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 ...Zilliz
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Último (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
"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 ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

안드로이드 세미나 2

  • 1. ANDROID 세미나 FOR BEGINNER (2) PoolC 홍철주 2012. 4. 18
  • 2. RESOURCE -> SOURCE CODE <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> </LinearLayout>
  • 4. RESOURCE -> SOURCE CODE public class TestActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button mButton = (Button)findViewById(R.id.button1); } }
  • 5. RESOURCE -> SOURCE CODE public final class R { public static final class attr { } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int button1=0x7f050000; } public static final class layout { public static final int main=0x7f030000; } public static final class string { public static final int app_name=0x7f040001; public static final int hello=0x7f040000; } }
  • 6. RESOURCE -> SOURCE CODE {ResourceType} {Varible} = (ResourceType)findViewById(ResourceAddress);
  • 7. RESOURCE -> SOURCE CODE Button mButton = (Button)findViewById(R.id.button1); // Button Listener : onClick -> call a function mButton.setOnClickListener(new Button.OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "Hello, World", Toast.LENGTH_SHORT).show(); } });
  • 8. ACTIVITY • 일단은 보이는 화면이라고 생각 • 당신은 화면 위에다가 터치도 하고 이것 저것한다 • 입력도 받고 출력도 받고 • 액티비티 주기를 볼 필요가 있긴 한데...
  • 9. INTENT • 안드로이드에서의 의사표현 수단 • 어떤 component를 부른다! • 그리고 무엇을 해달라고 요청!
  • 10. CONTEXT • 어플리케이션 환경의 전역 정보에 접근하기 위한 인터 페이스 • 시스템 정보 접근, API 호출 • 액티비티간 리소스 공유 등..
  • 11. INTENT -> NEW ACTIVITY! Intent mIntent = new Intent(TestActivity.this, SecondActivity.class); startActivity(mIntent); Intent 의 생성자는 여러가지. 이는 그 중 하나.
  • 12. SIMPLE CALCULATOR op1 opr op2 result
  • 13. SIMPLE CALCULATOR EditText op1, op2; TextView opr, result; Button plus, minus, mul, div;
  • 14. SIMPLE CALCULATOR public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); op1 = (EditText)findViewById(R.id.op1); op2 = (EditText)findViewById(R.id.op2); opr = (TextView)findViewById(R.id.opr); result = (TextView)findViewById(R.id.result); plus = (Button)findViewById(R.id.plus); plus.setOnClickListener(this); minus = (Button)findViewById(R.id.minus); minus.setOnClickListener(this); mul = (Button)findViewById(R.id.mul); mul.setOnClickListener(this); div = (Button)findViewById(R.id.div); div.setOnClickListener(this); } this? -> activity public class TestActivity extends Activity implements View.OnClickListener
  • 15. SIMPLE CALCULATOR public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()) { case R.id.plus: process(Operator.plus); break; case R.id.minus: process(Operator.minus); break; case R.id.mul: process(Operator.mul); break; case R.id.div: process(Operator.div); break; } }
  • 16. SIMPLE CALCULATOR void process(Operator op) { int op1Num = Integer.parseInt(op1.getText().toString()); int op2Num = Integer.parseInt(op2.getText().toString()); double resultNum = 0; switch(op) { case plus: resultNum = op1Num + op2Num; opr.setText("+"); break; case minus: resultNum = op1Num - op2Num; opr.setText("-"); break; case mul: resultNum = op1Num * op2Num; opr.setText("*"); break; case div: resultNum = (double)op1Num / op2Num; opr.setText("/"); break; } result.setText(Double.toString(resultNum));

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n