25
Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial 4.0 International Lic ense Create your first Android app Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial 4.0 International Lic ense Create your first Android app 1 Hola Mundo Lección 1 1 Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial 4.0 International Lic ense

Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

11

Hola Mundo

Lección 1

1

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Page 2: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

1.1 Crea tu primera aplicación de Android

2This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Page 3: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Contenidos

● Android Studio

● Creando la aplicación "Hello World" en Android Studio

● Flujo de trabajo de desarrollo de aplicaciones básicas con Android Studio

● Ejecutando aplicaciones en dispositivos virtuales y físicos

3

Page 4: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Prerequisitos

● Lenguaje de programación Java

● Programación orientada a objetos

● XML - propiedades / atributos

● Usando un IDE para desarrollo y depuración

4

Page 5: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Android Studio

5This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Page 6: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

¿Qué es Android Studio?

6

● IDE de Android● Estructura del proyecto● Plantillas● Editor de diseño● Herramientas de prueba● Construcción basada en

Gradle● Consola de registro● Depurador● Monitores● Emuladores

Page 7: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Descripción general de la instalación

● Mac, Windows, o Linux

● Requiere Java Development Kit (JDK) 1.7 o superior de la página de descargas de Oracle Java SE

● Establezca JAVA_HOME en la ubicación de instalación de JDK

● Descargue e instale Android Studio desde http://developer.android.com/sdk/index.html

7

Page 8: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Creando tu primera aplicación en Android

8This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Page 9: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Inicia Android Studio

9

Page 10: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Crea un proyecto dentro de Android Studio

10

Page 11: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Nombra tu app

1111

Page 12: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Elije una plantilla de Actividad

1212

Elija plantillas para actividades comunes, como mapas o cajones de navegación.

Elija Actividad vacía o Actividad básica para actividades simples y personalizadas.

Page 13: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Nombre tu actividad

1313

● Buena práctica para nombrar la actividad principal MainActivity y activity_main layout

● Utilice AppCompat

● Generar archivo de diseño es conveniente

Page 14: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

14

Archivos de proyecto

Android Studio Panes

Editor de diseño

Monitores Android:logcat: log messages

Page 15: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Carpetas de proyecto

15

1. manifest: archivo de manifiesto de Android: descripción de la app leída por el motor de ejecución de Android

2. java: paquetes de código fuente de Java

3. res: Recursos (XML): diseño, cadenas, imágenes, dimensiones, colores ...

4. build.gradle: archivos de compilación de Gradle

Page 16: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Sistema de construcción gradle● Moderno subsistema de construcción en Android Studio

● Tres build.gradle:

○ proyecto

○ módule

○ ajustes

● Normalmente no es necesario conocer detalles de Gradle de bajo nivel

● Obtenga más información sobre gradle en https://gradle.org/

16

Page 17: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Ejecuta tu app

1717

1. Ejecutar

2. Selecciona dispositivo

virtual o físico

3. OK

Page 18: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Crea un dispositivo virtual

18

Use emuladores para probar la aplicación en diferentes versiones de Android y factores de forma.

Tools > Android > AVD Manager or:

Page 19: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Configurar un dispositivo virtual

19

1. Elegir hardware 2. Seleccione la versión de Android3. Finalizar

Page 20: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Run on a virtual device

20

Page 21: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Ejecutar en un dispositivo físico

21

1. Activar las opciones de desarrollador:a. Settings > About phoneb. Pulse el número de compilación siete veces

2. Activar la depuración USBa. Settings > Developer Options > USB Debugging

3. Conecte el teléfono a la computadora con cable

Configuración adicional de Windows / Linux:● Using Hardware Devices

Controladores de Windows:● OEM USB Drivers

Page 22: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Recibe comentarios mientras se ejecuta la app

● A medida que se ejecuta la aplicación, Android Monitor Logcat muestra información

● Puede agregar declaraciones de registro a su aplicación que se mostrarán en logcat.

22

Page 23: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Loggingimport android.util.Log;

// Use class name as tagprivate static final String TAG = MainActivity.class.getSimpleName();

// Show message in Android Monitor, logcat pane// Log.<log-level>(TAG, "Message");Log.d(TAG, “Creating the URI…”);

23

Page 24: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Create your first Android

app

Android Monitor > logcat pane

1. Registrar declaraciones en código

2. panel logcat muestra el sistema y los mensajes de registro

24

● Configura filtros para ver lo que es importante● Buscar usando etiquetas

Page 25: Hola Mundo - Inicio€¦ · Hola Mundo Lección 1 Android Developer Fundamentals. Android Developer Fundamentals This work is licensed under a Creative Commons Attribution-No nCommercial

Android Developer Fundamentals

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License

Storing Data

FIN

28