Fragments
Todo lo que debes saber para programar apps
              multidispositivo.




                        http://androidtitlan.mx
Who i am?


     http://androidtitlan.mx
Enrique Díaz
GDG AndroidTitlan founder
     Android Hacker




               http://androidtitlan.mx
Indice     0. ¿Quién soy?
           0. Contexto Histórico
           1. Fragment
           2. Ejemplo 0:
           SimpleFragment
           3. Conclusiones
           4. Q & A




         http://androidtitlan.mx
http://androidtitlan.mx
Contexto
Histórico

     http://androidtitlan.mx
http://androidtitlan.mx
Contexto
Octubre 2008: Primer
smartphone con Android
                 API level = 1




               http://androidtitlan.mx
http://androidtitlan.mx
Contexto
Septiembre 2009: Android
Donut 1.6;
ldpi, mdpi & hdpi
API level = 4



                    http://androidtitlan.mx
http://androidtitlan.mx
Contexto
Febrero 2011:
           Android HoneyComb
            Nuevo identificador
                         xhdpi
                 API level = 11


                http://androidtitlan.mx
http://androidtitlan.mx
Contexto
Julio 2011: Android 3.2
                       Google TV
                   API level = 13




                  http://androidtitlan.mx
http://androidtitlan.mx
Fragment

 http://androidtitlan.mx
http://androidtitlan.mx
Fragment
API level 11
Android compatibility
package
Sub activity
Maneja su propio ciclo de
vida
               http://androidtitlan.mx
http://androidtitlan.mx
Ejemplo:
SimpleFragment



             http://androidtitlan.mx
SimpleFragments
                   Fragments FTW!


0. Creamos un nuevo proyecto llamado
“SimpleFragments”
1. Creamos una clase llamada ArticleFragment
que herede de Fragment
2. Agregamos ArticleFragment a la actividad
principal a través de XML
3. Agregamos un fragment a una activity en
tiempo de ejecución
4. Generamos la comunicación entre fragments
                              http://androidtitlan.mx
http://androidtitlan.mx
0. Creamos un nuevo
  proyecto llamado
 “SimpleFragments”



          http://androidtitlan.mx
http://androidtitlan.mx
1. Creamos una clase llamada
ArticleFragment que herede
        de Fragment


               http://androidtitlan.mx
http://androidtitlan.mx
2. Agregamos
ArticleFragment a la activity
       principal vía XML



                http://androidtitlan.mx
http://androidtitlan.mx
3. Agregamos un fragment a
   un activity en tiempo de
          ejecución


               http://androidtitlan.mx
http://androidtitlan.mx
4. Generamos la comunicación
      entre fragments



               http://androidtitlan.mx
http://androidtitlan.mx
¿Dudas?


    http://androidtitlan.mx
https://github.com/nRike/
    SimpleFragments


              http://androidtitlan.mx
Descarga el
 código fuente:
https://github.com/nRike/
    SimpleFragments


              http://androidtitlan.mx
Resumen


    http://androidtitlan.mx
SimpleFragment
+ Un fragment es una sub-actividad
+ Los fragments manejan su propio ciclo de
vida,
+ Fragments resuelven un problema de
diseño
+ Son de vital importancia para tablets &
Google TV
+ Android compatibility package nos permite
utilizar Fragments en Donut
Q&A



  http://androidtitlan.mx
by

http://bit.ly/and-drinks


                http://androidtitlan.mx
Te invito a And-
     Drinks
 AndroidTitlan:
           by

http://bit.ly/and-drinks


                http://androidtitlan.mx
Fragments
Todo lo que debes saber para programar apps
              multidispositivo.




            ¡Gracias!

Fragments, all you need to know for create multi-device apps.