SlideShare uma empresa Scribd logo
1 de 31
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   1
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   2
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
• General Magic fracasa y se va a la ruina, momento en el cual Andy se unió a Artemis Research y que
en 1997 fue comprada por Microsoft.
• Luego de varios años, renunció para fundar Danger Inc., que también fue adquirida por Microsoft en
2002, y fue destituido de su cargo de Director General.
• Su paso final en esta etapa, fundar en 2003 Android Inc.
• En el 2005, cuando Android Inc. contaba con 22 meses de vida, Google adquirió la empresa.
• No fue hasta el 5 de Noviembre de 2007 que se hizo el anuncio oficial de Android.
                                               I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                              3
                            DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   4
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   5
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   6
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   7
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   8
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   9
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   10
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   11
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
Archivo XML :: main.xml                                          Archivo Java :: MainActivity.java
<?xml version="1.0" encoding="utf-8"?>                           public class MainActivity extends Activity implements OnClickListener
<LinearLayout                                                    {
xmlns:android="http://schemas.android.com/apk/res/android"         private DatePicker dtpFechaNac;
  android:orientation="vertical"                                   private Button btnCalcular;
  android:layout_width="fill_parent"                               /** Called when the activity is first created. */
  android:layout_height="fill_parent"                              @Override
  android:background="#FFFFFF"                                     public void onCreate(Bundle savedInstanceState)
  android:gravity="center"                                         {
  >                                                                  super.onCreate(savedInstanceState);
  <TextView                                                          setContentView(R.layout.main);
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"                              dtpFechaNac = (DatePicker) this.findViewById(R.id.dtpFechaNac);
     android:text="Dame tu Fecha de Nacimiento"                        btnCalcular = (Button) this.findViewById(R.id.btnCalcular);
     android:gravity="center"                                          btnCalcular.setOnClickListener(this);
     android:textColor="#000000"                                   }
     android:textSize="18px"
  />                                                               public void onClick(View view) {
  <DatePicker                                                        dtpFechaNac.refreshDrawableState();
     android:id="@+id/dtpFechaNac"                                   Toast.makeText(this.getBaseContext(), "La Edad es: " +
     android:layout_width="fill_parent"                          calculaEdad(dtpFechaNac.getDayOfMonth(),dtpFechaNac.getMonth(),dtp
     android:layout_height="wrap_content"                        FechaNac.getYear()) , Toast.LENGTH_LONG).show();
  />                                                               }
  <Button
     android:layout_width="wrap_content"                           private int calculaEdad(int dia, int mes, int anio){
     android:layout_height="wrap_content"                            Calendar nacimiento = Calendar.getInstance();
     android:text="Calcular Edad"                                    nacimiento.set(anio,mes,dia);
     android:id="@+id/btnCalcular"                                   return Calendar.getInstance().get(Calendar.YEAR) -
  />                                                             nacimiento.get(Calendar.YEAR);
</LinearLayout>                                                    }
                                                                 }
                                                          I.S.C. Oscar Eduardo Roa Vela
    NOVIEMBRE, 2011                                                                                                                12
                                       DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   13
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   14
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   15
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   16
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   17
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   18
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   19
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   20
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   21
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                   22
                  DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
<TextView
                  android:id="@+id/nameLabel"
                  android:text="phone:"
                  android:layout_width="100"
                  android:layout_height="60" />
                                          I.S.C. Oscar Eduardo Roa Vela
NOVIEMBRE, 2011                                                                        23
                       DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
Cuando se compila la aplicación se compila también cada archivo xml de presentación y queda
accesible desde la clase R “View Resource” generada por android.

                      <Button android:id="@+id/btnAceptar"
                      android:text="@string/aceptar"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content" />
findViewById. Permite acceder a la vista desde una actividad


                      Button btn = (Button) findViewById(R.id. btnAceptar);


R.Java Clase generada por Android que permite acceder a los recursos una vez compilados como
atributos estáticos


                                               I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                           24
                            DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
Un Layout’s son contenedores invisibles que determinan la disposición de las vistas en la pantalla.


Todos los layouts heredan de ViewGroup. Android recomienda definir el layout en XML mediante
archivos de layout que se encuentran en res/layout/main_layout.xml.


Cuando se compila la aplicación se compila también cada archivo xml de layout y queda accesible
desde la clase R “View Resource” generada por Android.



               public void onCreate(Bundle savedInstanceState) {
                         super.onCreate(savedInstanceState);
                         setContentView(R.layout.main);
               }


                                               I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                                     25
                            DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
Tipos de layout:


• LinearLayout: dispone los hijos horizontal o verticalmente
• RelativeLayout: dispone unos elementos relativos a los otros
• TableLayout: dispone los elementos en filas y columnas
• AbsoluteLayout: dispone los elementos en coordenadas exactas
• FrameLayout: permite cambiar dinámicamente los controles en el layout


La clase Layout contiene una clase LayoutParams que es especializada por cada tipo de Layout.
(LinearLayoutParams, RelativeLayoutParams,…)




                                               I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                           26
                            DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
Android viene con un conjunto de vistas “controles” bastante completo para dibujar textos, botones,
obtener fechas, mostrar listas, mostrar imágenes, webs, mapas, etc.




                                              I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                            27
                           DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
Texto. Android incluye distintos componentes para mostrar y permitir la entrada de texto por parte del
usuario.


Vistas de Texto


• TextView Muestra el texto. No permite editarlo (Label).
• EditText Componente de edición de texto, acepta varias líneas
• AutoCompleteTextView Ofrece sugerencias del texto escrito
• MultiAutoCompleteTextView Ofrece sugerencias de cada palabra




                                               I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                               28
                            DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
Botones. Existen todo tipo de botones, botones simples, con imágenes, check buttons, radio buttons,
toogle buttons…


• Button. Botón estandar
• ImageButton. Botón con imagen
• ToogleButton. Botón de 2 estados On | Off
• CheckBox. Checkbox estandar , selección multiple
• RadioButton. RadioButton estandar, selección simple




                                              I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                            29
                           DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
ListView. Muestra una lista de elementos verticalmente. Se puede diseñar la apariencia de los
elementos de la lista. Normalmente se usa con una ListActivity y un ListAdapter.


Pasos para crear un ListView
1. Diseñar la vista de los elementos de la lista en res/layout/listItem.xml
2. Crear una actividad que herede de ListActivity
3. Pasarle los datos al adaptador de la lista
4. En onCreate asignarle el ListAdapter a la actividad
5. Añadirle la vista a la actividad




                                                  I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                              30
                               DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
WebView. Permite embeber un navegador en una actividad. El navegador incluye opciones para
navegar hacia adelante y hacia atrás, zoom, etc


Pasos para crear un WebView
1. Diseñar la vista en res/layout/main.xml
2. Modificar el AndroidManifest.xml para añadir permisos y configurar a pantalla completa
3. Crear una actividad
4. En onCreate llamar al setContentView pasándole el id de la vista




                                               I.S.C. Oscar Eduardo Roa Vela
  NOVIEMBRE, 2011                                                                           31
                            DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS

Mais conteúdo relacionado

Destaque

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Android presentacion

  • 1. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 1 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 2. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 2 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 3. • General Magic fracasa y se va a la ruina, momento en el cual Andy se unió a Artemis Research y que en 1997 fue comprada por Microsoft. • Luego de varios años, renunció para fundar Danger Inc., que también fue adquirida por Microsoft en 2002, y fue destituido de su cargo de Director General. • Su paso final en esta etapa, fundar en 2003 Android Inc. • En el 2005, cuando Android Inc. contaba con 22 meses de vida, Google adquirió la empresa. • No fue hasta el 5 de Noviembre de 2007 que se hizo el anuncio oficial de Android. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 3 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 4. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 4 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 5. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 5 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 6. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 6 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 7. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 7 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 8. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 8 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 9. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 9 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 10. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 10 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 11. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 11 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 12. Archivo XML :: main.xml Archivo Java :: MainActivity.java <?xml version="1.0" encoding="utf-8"?> public class MainActivity extends Activity implements OnClickListener <LinearLayout { xmlns:android="http://schemas.android.com/apk/res/android" private DatePicker dtpFechaNac; android:orientation="vertical" private Button btnCalcular; android:layout_width="fill_parent" /** Called when the activity is first created. */ android:layout_height="fill_parent" @Override android:background="#FFFFFF" public void onCreate(Bundle savedInstanceState) android:gravity="center" { > super.onCreate(savedInstanceState); <TextView setContentView(R.layout.main); android:layout_width="fill_parent" android:layout_height="wrap_content" dtpFechaNac = (DatePicker) this.findViewById(R.id.dtpFechaNac); android:text="Dame tu Fecha de Nacimiento" btnCalcular = (Button) this.findViewById(R.id.btnCalcular); android:gravity="center" btnCalcular.setOnClickListener(this); android:textColor="#000000" } android:textSize="18px" /> public void onClick(View view) { <DatePicker dtpFechaNac.refreshDrawableState(); android:id="@+id/dtpFechaNac" Toast.makeText(this.getBaseContext(), "La Edad es: " + android:layout_width="fill_parent" calculaEdad(dtpFechaNac.getDayOfMonth(),dtpFechaNac.getMonth(),dtp android:layout_height="wrap_content" FechaNac.getYear()) , Toast.LENGTH_LONG).show(); /> } <Button android:layout_width="wrap_content" private int calculaEdad(int dia, int mes, int anio){ android:layout_height="wrap_content" Calendar nacimiento = Calendar.getInstance(); android:text="Calcular Edad" nacimiento.set(anio,mes,dia); android:id="@+id/btnCalcular" return Calendar.getInstance().get(Calendar.YEAR) - /> nacimiento.get(Calendar.YEAR); </LinearLayout> } } I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 12 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 13. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 13 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 14. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 14 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 15. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 15 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 16. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 16 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 17. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 17 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 18. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 18 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 19. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 19 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 20. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 20 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 21. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 21 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 22. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 22 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 23. <TextView android:id="@+id/nameLabel" android:text="phone:" android:layout_width="100" android:layout_height="60" /> I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 23 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 24. Cuando se compila la aplicación se compila también cada archivo xml de presentación y queda accesible desde la clase R “View Resource” generada por android. <Button android:id="@+id/btnAceptar" android:text="@string/aceptar" android:layout_width="wrap_content" android:layout_height="wrap_content" /> findViewById. Permite acceder a la vista desde una actividad Button btn = (Button) findViewById(R.id. btnAceptar); R.Java Clase generada por Android que permite acceder a los recursos una vez compilados como atributos estáticos I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 24 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 25. Un Layout’s son contenedores invisibles que determinan la disposición de las vistas en la pantalla. Todos los layouts heredan de ViewGroup. Android recomienda definir el layout en XML mediante archivos de layout que se encuentran en res/layout/main_layout.xml. Cuando se compila la aplicación se compila también cada archivo xml de layout y queda accesible desde la clase R “View Resource” generada por Android. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 25 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 26. Tipos de layout: • LinearLayout: dispone los hijos horizontal o verticalmente • RelativeLayout: dispone unos elementos relativos a los otros • TableLayout: dispone los elementos en filas y columnas • AbsoluteLayout: dispone los elementos en coordenadas exactas • FrameLayout: permite cambiar dinámicamente los controles en el layout La clase Layout contiene una clase LayoutParams que es especializada por cada tipo de Layout. (LinearLayoutParams, RelativeLayoutParams,…) I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 26 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 27. Android viene con un conjunto de vistas “controles” bastante completo para dibujar textos, botones, obtener fechas, mostrar listas, mostrar imágenes, webs, mapas, etc. I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 27 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 28. Texto. Android incluye distintos componentes para mostrar y permitir la entrada de texto por parte del usuario. Vistas de Texto • TextView Muestra el texto. No permite editarlo (Label). • EditText Componente de edición de texto, acepta varias líneas • AutoCompleteTextView Ofrece sugerencias del texto escrito • MultiAutoCompleteTextView Ofrece sugerencias de cada palabra I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 28 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 29. Botones. Existen todo tipo de botones, botones simples, con imágenes, check buttons, radio buttons, toogle buttons… • Button. Botón estandar • ImageButton. Botón con imagen • ToogleButton. Botón de 2 estados On | Off • CheckBox. Checkbox estandar , selección multiple • RadioButton. RadioButton estandar, selección simple I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 29 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 30. ListView. Muestra una lista de elementos verticalmente. Se puede diseñar la apariencia de los elementos de la lista. Normalmente se usa con una ListActivity y un ListAdapter. Pasos para crear un ListView 1. Diseñar la vista de los elementos de la lista en res/layout/listItem.xml 2. Crear una actividad que herede de ListActivity 3. Pasarle los datos al adaptador de la lista 4. En onCreate asignarle el ListAdapter a la actividad 5. Añadirle la vista a la actividad I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 30 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS
  • 31. WebView. Permite embeber un navegador en una actividad. El navegador incluye opciones para navegar hacia adelante y hacia atrás, zoom, etc Pasos para crear un WebView 1. Diseñar la vista en res/layout/main.xml 2. Modificar el AndroidManifest.xml para añadir permisos y configurar a pantalla completa 3. Crear una actividad 4. En onCreate llamar al setContentView pasándole el id de la vista I.S.C. Oscar Eduardo Roa Vela NOVIEMBRE, 2011 31 DESARROLLO DE APLICACIONES MÓVILES CON ACCESO A DATOS REMOTOS