SlideShare une entreprise Scribd logo
1  sur  48
/**

*     Java
*     para Dispositivos Móviles
*/




public class {

      public static void main (String [] a) {


          MCs. Javier González Sánchez;
          javiergs@itesm.mx;

          ITESM, campus Guadalajara;
      }

  }
g.drawString(“   Agenda” );


                  agenda[   1 Dispositivos móviles
                             ]=“                               ”;




                  agenda[   2 Java micro-edition
                             ]=                    ”);




                  agenda[   3 programación con objetos y Java
                             ]=




                  agenda[   4 MIDlet.HolaMundo
                             ]=




                  agenda[   5 MIDlet.widgets
                             ]=




                  agenda[   6 MIDlet.canvas
                             ]=




                  agenda[   7 MIDlet.red
                             ]=




                   agenda[   8 MIDlet.conclusiones
                              ]=                         ”);




                                                                    javiergs@itesm.mx
agenda[   1 Dispositivos móviles
          ]=                                   ”);




               •   SMS (Short Service Message Service). Mensajes de máximo 160
                   caracteres

               •   WAP y WML. Web de baja fiabilidad, velocidad y alto costo.

               •   GPRS (General Packet Radio Service) transferencia de datos
                   multimedia con cualidades aceptables.

               •   MMS (Multimedia Message Service)


               •   J2ME (Java 2 micro-edition) entorno de desarrollo
                   Archivos JAR y JAD


               •   Symbian: sistema operativo: Nokia, sony-ericsson, Motorola
                   Archivos SIS


                                                                  javiergs@itesm.mx
g.drawString(“   Agenda” );


                  agenda[   1 Dispositivos móviles
                             ]=“                               ”;




                  agenda[   2 Java micro-edition
                             ]=                    ”);




                  agenda[   3 programación con objetos y Java
                             ]=




                  agenda[   4 MIDlet.HolaMundo
                             ]=




                  agenda[   5 MIDlet.widgets
                             ]=




                  agenda[   6 MIDlet.canvas
                             ]=




                  agenda[   7 MIDlet.red
                             ]=




                   agenda[   8 MIDlet.conclusiones
                              ]=                         ”);




                                                                    javiergs@itesm.mx
agenda[   2 historia de Java
          ]=“                              ”;




                Diciembre 1990:

                •   Green Project, Oak, Duke …
                    http://today.java.net/jag/old/green/



                Octubre 2004:

                •   Portafolio de productos basados en la red y con la
                    filosofía de que el mismo software debe ser ejecutable
                    en diferentes dispositivos y/o sistemas.

                •   J2SE = base de la tecnología Java
                •   J2EE = entorno empresarial, redes, acceso a datos
                •   J2ME = entornos limitados

                                                              javiergs@itesm.mx
agenda[   2 Java2.inicio()
          ]=                 ”);




                MIDlets            Applets      Servlet

                          Aplicación gráfica    JSP

                             Aplicación texto   Java Beans




                                                      javiergs@itesm.mx
agenda[   2 J2ME.MIDlets
          ]=                    (“   Mobile Java ”);



               Java 2 Micro Edition



               •   Omite el soporte a operaciones con punto flotante y los tipos
                   de datos que manejan esa información

               •   Limita el número de Exception disponibles para control de
                   Errores

               •   Para dispositivos con Configuración CLDC (Connected Limited
                   Device Configuration): PDAs y teléfonos móviles. Y el caso
                   particular de teléfonos móviles el perfil MIDP (Móvil
                   Information Device Profile)



               •   Maquina Virtual minimizada (K Virtual Machine)



                                                                    javiergs@itesm.mx
agenda[   2 J2ME.MIDlets
          ]=                     (“   Mobile Java ”);




               MIDlet:

               •   programa capaz de ejecutarse en un dispositivo móvil.



               Herramientas de trabajo:

               •   J2ME Wireless Toolkit 2.5
                   [http://java.sun.com/j2me/download.html ]

               •   J2SE SDK es necesario como base.




                                                               javiergs@itesm.mx
g.drawString(“   Agenda” );


                  agenda[   1 Dispositivos móviles
                             ]=“                               ”;




                  agenda[   2 Java micro-edition
                             ]=                    ”);




                  agenda[   3 programación con objetos y Java
                             ]=




                  agenda[   4 MIDlet.HolaMundo
                             ]=




                  agenda[   5 MIDlet.widgets
                             ]=




                  agenda[   6 MIDlet.canvas
                             ]=




                  agenda[   7 MIDlet.red
                             ]=




                   agenda[   8 MIDlet.conclusiones
                              ]=                         ”);




                                                                    javiergs@itesm.mx
agenda[   3 programación
          ]=“                     ”;




                •   Variables, Tipos de dato, Operadores

                •   Clases, Objetos

                •   Atributos, Métodos

                •   Paquetes, APIs

                •   Herencia, Sobrecarga, Sobreescritura

                •   Estructuras de control

                •   Excepciones

                •   Estructuras de Datos: arreglos


                                                           javiergs@itesm.mx
agenda[   3 modelar el mundo real ”;
           ]=“




                 Clase = molde   Objeto = cosa

                   herencia        se usar       Son hijos de
                                  se tienen
                  atributos                        se usan
                   metodos        atributos
                                   metodos         tienen




                                                      javiergs@itesm.mx
agenda[   3]=“ a trabajar …                ”;



             class Coche {
              int velocidad;

               void acelerar( int nuevaVelocidad) {
                 velocidad = nuevaVelocidad;
               }
              void frenar() {
                 velocidad = 0;
              }
             }


             class Mundo {
              public static void main (String [] arg) {

                  Coche miCoche = new Coche();

                  miCoche.acelerar(100);

                  miCoche.frenar();

              }
             }



                                                          javiergs@itesm.mx
agenda[   3]=“ y se puede complicar …                     ”;



             class Coche extends Bicicleta{
              int velocidad;

               void acelerar( int nuevaVelocidad) {
                velocidad = nuevaVelocidad;
               }
              void frenar() {
                velocidad = 0;
              }
             }


             class Mundo {
              public static void main (String [] arg) {

                  Coche miCoche = new Coche();

               miCoche.acelerar(100);

                  miCoche.frenar();

              }
             }



                                                               javiergs@itesm.mx
agenda[   3] =“ compilar y ejecutar …   ”;




                 archivo.java                archivo.class




                                                       javiergs@itesm.mx
g.drawString(“   Agenda” );


                  agenda[   1 Dispositivos móviles
                             ]=“                               ”;




                  agenda[   2 Java micro-edition
                             ]=                    ”);




                  agenda[   3 programación con objetos y Java
                             ]=




                  agenda[   4 MIDlet.HolaMundo
                             ]=




                  agenda[   5 MIDlet.widgets
                             ]=




                  agenda[   6 MIDlet.canvas
                             ]=




                  agenda[   7 MIDlet.red
                             ]=




                   agenda[   8 MIDlet.conclusiones
                              ]=                         ”);




                                                                    javiergs@itesm.mx
agenda[   4 J2ME.Wireless Toolkit
          ]=                                 ”);




                                                      project:package
                           Device:emulador
                                                           *.jar
                                Build                      *.jad
                                 Run




                                                   javiergs@itesm.mx
agenda[   4 J2ME.MIDlets
          ]=                         (“   Mobile Java ”);



               import javax.microedition.midlet.*;
               import javax.microedition.lcdui.*;

               public class HelloWorld extends MIDlet implements CommandListener {
                  private Command exitCommand;
                  private Display display;
                  private Form screen;

                  public HelloWorld() {
                     // Obtenemos el objeto Display del midlet.
                     display = Display.getDisplay(this);

                      // Creamos el comando Salir.
                      exitCommand = new Command("Salir", Command.EXIT,2);

                      // Creamos la pantalla principal (un formulario)
                      screen = new Form("HelloWorld");

                      // Creamos y añadimos la cadena de texto a la pantalla
                      StringItem saludo = new StringItem("","Hola Mundo...");
                      screen.append(saludo);

                      // Añadimos el comando Salir e indicamos que clase lo manejará
                      screen.addCommand(exitCommand);
                      screen.setCommandListener(this);
                  }

                                                                                  javiergs@itesm.mx
agenda[   4 J2ME.MIDlets
          ]=                           (“   Mobile Java ”);



                   public void startApp() throws MIDletStateChangeException {
                      // Seleccionamos la pantalla a mostrar
                      display.setCurrent(screen);
                   }

                   public void pauseApp() {

                   }


                   public void destroyApp(boolean incondicional) {

                   }


                   public void commandAction(Command c, Displayable s) {
                      // Salir
                      if (c == exitCommand) {
                         destroyApp(false);
                         notifyDestroyed();
                      }
                   }


               }

                                                                                javiergs@itesm.mx
agenda[   4 Opciones
          ]=           ”);




                               Sony-ericsson SDK
                 Archivo.jar
                                  Nokia Suite
                 Archivo.jad         etc.

                                                   javiergs@itesm.mx
agenda[   4 Opciones
          ]=           ”);




                             javiergs@itesm.mx
agenda[   4 MIDlets
          ]=           (“   anatomía ”);



               Hijo de: javax.microedition.midlet.MIDlet

               Sobrescribir:
               • startApp()
               • pauseApp()
               • destroyApp()

               Listener:
               •   commandAction()

               CLDC (Connected Limited Device Configuration):

               •   java.lang
               •   java.util
               •   java.io
               •   Generic Conection Framework


                                                                javiergs@itesm.mx
agenda[   4 MIDlets
          ]=           (“   anatomía ”);



               MIDP (Móvil Information Device Profile)

               •   javax.microedition.midlet
                   Contiene la clase MIDlet

               •   javax.microedition.lcdui
                   Interfase de usuario: Screen, Canvas

               •   javax.microedition.io
               •   javax.microedition.rms
               •   Timer
               •   TimerTask




                                                          javiergs@itesm.mx
agenda[   4 MIDlets
          ]=          (“   fisiología ”);



               Display display = Display.getDisplay(this);


               Command exitCommand = new Command("Salir", Command.EXIT,2);

               Tipos de comandos disponibles:
               OK, CANCEL, BACK, STOP, HELP, SCREEN, ITEM.

               Form screen = new Form("HelloWorld");
               screen.addCommand(exitCommand);
               screen.setCommandListener(this);

               StringItem saludo = new StringItem("","Hola Mundo...");
               screen.append(saludo);

               display.setCurrent(screen);




                                                                 javiergs@itesm.mx
g.drawString(“   Agenda” );


                  agenda[   1 Dispositivos móviles
                             ]=“                               ”;




                  agenda[   2 Java micro-edition
                             ]=                    ”);




                  agenda[   3 programación con objetos y Java
                             ]=




                  agenda[   4 MIDlet.HolaMundo
                             ]=




                  agenda[   5 MIDlet.widgets
                             ]=




                  agenda[   6 MIDlet.canvas
                             ]=




                  agenda[   7 MIDlet.red
                             ]=




                   agenda[   8 MIDlet.conclusiones
                              ]=                         ”);




                                                                    javiergs@itesm.mx
agenda[   4 MIDlets
          ]=          (“   Screen ”);




                                        javiergs@itesm.mx
agenda[   4 MIDlets
          ]=           (“   Screen ”);



               Las clases que heredan de Screen pueden aparecer en pantalla

               Solo una a la vez

               Heredan:
               • String getTitle() // devuelve el título de la pantalla
               • void setTitle(String s) // establece el título de la pantalla
               • Ticker getTicker() // Devuelve el ticker de la pantalla
               • void setTicker(Ticker ticker) // Establece el ticker de la pantalla


               Podemos generar varios objetos e intercalarlos


               display.setCurrent(objeto);




                                                                        javiergs@itesm.mx
agenda[   4 MIDlets
          ]=              (“   Alert ”);



               Permite mostrar una pantalla de texto hasta que se produzca un
               comando de tipo OK. Se utiliza para mostrar mensajes de error y
               Avisos

               Alert (
                  String título, String texto_alerta,
                  Image imagen_alerta, //null para no utilizar imagen
                  AlertType tipo_alerta); //ALARM, CONFIRMATION, ERROR,   INFO, WARNING


               Ejemplo:

               Alert alerta;
               alerta = new Alert ("Error","El dato no es válido", null,AlertType.ERROR);
               display.setCurrent(alerta);
               alerta.setTimeout(Alert.FOREVER);
               // tiempo en ms o establecer permante




                                                                            javiergs@itesm.mx
agenda[   4 MIDlets
          ]=                (“   List ”);



               Crear listas de elementos seleccionables

               List (
                  String título,
                    int tipo_lista, // EXCLUSIVE, IMPLICIT, MULTIPLE
                    String[] elementos,
                    image[] imágenes)

               Ejemplo:

               String[] ciudades = {"Málaga", "Madrid", "Melilla"};
               List lista = new List ("Seleccione ciudad", List.EXCLUSIVE, ciudades,
                   null);

               ..

               Lista.getString ( lista.getSelectedIndex() );




                                                                          javiergs@itesm.mx
agenda[   4 MIDlets
          ]=              (“   TextBox ”);



               Permite introducir y editar texto a pantalla completa

               TextBox (
                   String título,
                  String texto,   // texto inicial a desplegar
                  int tamaño_max, // en caracteres
                  int limitación) // ANY, EMAILADDR, NUMERIC, PASSWORD, PHONENUMBER, URL


               Ejemplo:

               TextBox texto = new TextBox ("Mensaje", "", 256, TextField.ANY);




                                                                                javiergs@itesm.mx
agenda[   4 MIDlets
          ]=            (“   Form ”);



               Es un contenedor, aglutina una serie de elementos visuales




                Ejemplo:
                StringItem saludo = new StringItem("","Hola Mundo...");
                Form screen.append(saludo);

                                                                  javiergs@itesm.mx
agenda[   4 MIDlets
          ]=               (“   Form ”);



               Métodos:

               •   append(Item)
               •   delete(int)
               •   insert(int, Item)
               •   set(int, Item)
               •   size()

               Listener:

               •   ItemstateListener
               •   formulario.setItemStateListener(this);
               •   void itemStateChanged(Item elemento)




                                                            javiergs@itesm.mx
agenda[   4 MIDlets
          ]=               (“   Item ”);



               StringItem (String etiqueta, String texto)
               String getText()
               void setText(String texto)



               ImageItem (String etiqueta,
                          Image img,
                          int layout, // posicion        LAYOUT_DEFAULT, LAYOUT_LEFT ..

                         String texto_alternativo)             //a mostrar en vez de la imagen


               *las imágenes se colocan en el directorio res


               TextField (
                  String etiqueta,
                  String texto,
                  int tamaño_max, int limitación)



                                                                                      javiergs@itesm.mx
agenda[   4 MIDlets
          ]=               (“   Item ”);



               DateField (
                  String etiqueta,
                  int modo) // DATE,       TIME, DATE_TIME


               Date getDate()
               void setDate (Date fecha)

               ChoiceGroup (
                  String etiqueta, int tipo_lista,
                  String[] elementos, image[] imágenes)



               Gauge (
                  String etiqueta, bolean interactivo,       //permitir modificar al usr
                  int val_max, int val_ini)

               * Barra de estado



                                                                           javiergs@itesm.mx
agenda[   4 MIDlets
          ]=                  (“   Item ”);


           import javax.microedition.midlet.*;
           import javax.microedition.lcdui.*;

           public class Items extends MIDlet implements CommandListener {
            private Command exitCommand;
            private Display display;
            private Form screen;

               public Items() {
                String[] estados = {"Casado","Soltero","Divorciado","Viudo"};
                display = Display.getDisplay(this);
                exitCommand = new Command("Salir", Command.EXIT,2);
                screen = new Form("Interfaz de usuario");

               TextField nombre = new TextField("Nombre","",30,TextField.ANY);
               DateField fecha_nac = new DateField("Fecha de nacimiento", DateField.DATE);
               ChoiceGroup estado = new ChoiceGroup("Estado",List.EXCLUSIVE,estados,null);
               screen.append(nombre);
               screen.append(fecha_nac);
               screen.append(estado);

                screen.addCommand(exitCommand);
                screen.setCommandListener(this);
               }

                                                                                javiergs@itesm.mx
agenda[   4 MIDlets
          ]=                 (“   Item ”);




               public void startApp() throws MIDletStateChangeException {
                // Seleccionamos la pantalla a mostrar
                display.setCurrent(screen);
               }

               public void pauseApp() {
               }

               public void destroyApp(boolean incondicional) {
               }

                public void commandAction(Command c, Displayable s) {
                 // Salir
                 if (c == exitCommand) {
                  destroyApp(false);
                  notifyDestroyed();
                 }
                }
               }




                                                                            javiergs@itesm.mx
g.drawString(“   Agenda” );


                  agenda[   1 Dispositivos móviles
                             ]=“                               ”;




                  agenda[   2 Java micro-edition
                             ]=                    ”);




                  agenda[   3 programación con objetos y Java
                             ]=




                  agenda[   4 MIDlet.HolaMundo
                             ]=




                  agenda[   5 MIDlet.widgets
                             ]=




                  agenda[   6 MIDlet.canvas
                             ]=




                  agenda[   7 MIDlet.red
                             ]=




                   agenda[   8 MIDlet.conclusiones
                              ]=                         ”);




                                                                    javiergs@itesm.mx
agenda[   4 MIDlets
          ]=              (“   canvas ”);



               import javax.microedition.midlet.*;
               import javax.microedition.lcdui.*;

               public class Canvas1 extends MIDlet implements CommandListener {
                 private Command exitCommand;
                 private Display display;
                 private SSCanvas screen;
                 public Canvas1() {
                    display=Display.getDisplay(this);
                    exitCommand = new Command("Salir",Command.SCREEN,2);
                    screen=new SSCanvas();
                    screen.addCommand(exitCommand);
                    screen.setCommandListener(this);
                 }
                 public void startApp() throws MIDletStateChangeException {
                    display.setCurrent(screen);
                 }
                 public void pauseApp() {}
                 public void destroyApp(boolean unconditional) {}
                 public void commandAction(Command c, Displayable s) {
                    if (c == exitCommand) {
                     destroyApp(false); notifyDestroyed();
                    }
                  }
               }
                                                                                  javiergs@itesm.mx
agenda[   4 MIDlets
          ]=              (“   canvas   ”);




               class SSCanvas extends Canvas {

               public void paint(Graphics g) {
                 g.setColor(255,255,255);
                 g.fillRect (0, 0, getWidth(), getHeight());
                 q.setColor(10,200,100);
                    g.drawLine (0, 0, 100, 100);
                    g.fillRect (50, 50, 30, 30);
                    Image img = Image.createImage(“/logo.png");
                    g.drawImage (img, 10, 10, Graphics.HCENTER, Graphics.VCENTER);
                }


               }




                                                                          javiergs@itesm.mx
agenda[   4 juegos
          ]=         ”);




                                             (1)
                                         Movimiento

                                          Animación

                                          Colisión




                           Una clase que represente al avión y
                           permita su manipulación




                                                      javiergs@itesm.mx
agenda[   4 teclado
          ]=           ”);




               // Lectura del Teclado: keyPressed(), keyReleased() y keyRepeated().

               public void keyPressed(int keyCode) {
                   int action = getGameAction(keyCode);
                   switch (action) {
                          case FIRE:
                               // Disparar
                               break;
                           case LEFT:
                               // Mover a la izquierda
                               break;
                           case RIGHT:
                               // Mover a la derecha
                               break;
                           case UP:
                               // Mover hacia arriba
                               break;
                           case DOWN:
                               // Mover hacia abajo
                               break;
                       }
                   }


                                                                       javiergs@itesm.mx
agenda[   4 hilos
          ]=           ”);




               public void run() {

                   iniciar();

                   while (true) {

                         // Actualizar fondo de pantalla
                         doScroll();

                         // Actualizar posición del jugador
                         computePlayer();

                         // Actualizar pantalla
                         repaint();
                         serviceRepaints();

                             try {
                                 Thread.sleep(sleepTime);            Y el teclado
                              } catch (InterruptedException e) { }
                                                                     Con sus
                                                                     Pseudo- listeners
                   }
               }
                                                                        javiergs@itesm.mx
g.drawString(“   Agenda” );


                  agenda[   1 Dispositivos móviles
                             ]=“                               ”;




                  agenda[   2 Java micro-edition
                             ]=                    ”);




                  agenda[   3 programación con objetos y Java
                             ]=




                  agenda[   4 MIDlet.HolaMundo
                             ]=




                  agenda[   5 MIDlet.widgets
                             ]=




                  agenda[   6 MIDlet.canvas
                             ]=




                  agenda[   7 MIDlet.red
                             ]=




                   agenda[   8 MIDlet.conclusiones
                              ]=                         ”);




                                                                    javiergs@itesm.mx
agenda[   4 MIDlets
          ]=            (“   red ”);



               try {

                c = (HttpConnection)Connector.open(url);
                c.setRequestMethod(HttpConnection.GET);
                c.setRequestProperty("IF-Modified-Since", "10 Nov 2000 17:29:12 GMT");
                c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/
                  CLDC-1.0");
                c.setRequestProperty("Content-Language", "es-ES");
                is = c.openInputStream();
                int ch, i, j;

                // leer los datos desde la URL
                while ((ch = is.read()) != -1) {
                    b.append((char) ch);
                }

                // mostrar noticias en la pantalla
                t = new TextBox("Noticias en barrapunto.com", salida.toString(), 1024,
                  0);


                                                                         javiergs@itesm.mx
g.drawString(“   Agenda” );


                  agenda[   1 Dispositivos móviles
                             ]=“                               ”;




                  agenda[   2 Java micro-edition
                             ]=                    ”);




                  agenda[   3 programación con objetos y Java
                             ]=




                  agenda[   4 MIDlet.HolaMundo
                             ]=




                  agenda[   5 MIDlet.widgets
                             ]=




                  agenda[   6 MIDlet.canvas
                             ]=




                  agenda[   7 MIDlet.red
                             ]=




                   agenda[   8 MIDlet.conclusiones
                              ]=                         ”);




                                                                    javiergs@itesm.mx
System.out.println(“   Conclusiones   ”);




   Java

  World




                                            javiergs@itesm.mx
out.println(“   Referencias                  ”);




  mucho
                 public interface   J2   {

    por              http://java.sun.com;
                     http://www.java.com;
 aprender            http://java.net
    &&           }


  seguir

trabajando       public interface   J2ME           extends J2 {

                     http://java.sun.con/j2me/
                 }




                 public interface   Otros             extends J2 {

                     http://www.symbian.com/
                     http://developer.sonyericsson.com/
                 }


                                                                     javiergs@itesm.mx
out.println(“   Para divertirse            ”);




A jugar!
                 public interface   Nintendo en tu celular        {


                     http://www.ba-k.com/
                     index.php?/archives/
                     710-Vnes-1.20-JUEGA-NINTENDO-EN-TU-CELULAR.html;

                 }




                 public interface   VNES for J2ME   {


                     http://www.vampent.com/vnes.htm;

                 }




                                                           javiergs@itesm.mx
super(“   ¡ Gracias 2007 !”);




              public stop () {



              http://   www.javiergs.com
              javiergs@itesm.mx
              }

                                           javiergs@itesm.mx

Contenu connexe

Similaire à 200710 - Java para dispositivos móviles

Similaire à 200710 - Java para dispositivos móviles (20)

MVC
MVCMVC
MVC
 
S8-DAW-2022S1.pptx
S8-DAW-2022S1.pptxS8-DAW-2022S1.pptx
S8-DAW-2022S1.pptx
 
Arquitectura e-sijad
Arquitectura e-sijadArquitectura e-sijad
Arquitectura e-sijad
 
Desarrollo en Android: Conceptos Básicos
Desarrollo en Android: Conceptos BásicosDesarrollo en Android: Conceptos Básicos
Desarrollo en Android: Conceptos Básicos
 
Fundamentos de programacion
Fundamentos de programacionFundamentos de programacion
Fundamentos de programacion
 
Taller Android seedrocket
Taller Android seedrocketTaller Android seedrocket
Taller Android seedrocket
 
G te c sesion3b- mapreduce
G te c sesion3b- mapreduceG te c sesion3b- mapreduce
G te c sesion3b- mapreduce
 
Presentacion javascript
Presentacion javascriptPresentacion javascript
Presentacion javascript
 
Java Web 00 - Contexto
Java Web 00 - ContextoJava Web 00 - Contexto
Java Web 00 - Contexto
 
Aplicaciones en red ppt
Aplicaciones en red pptAplicaciones en red ppt
Aplicaciones en red ppt
 
Mobile Day - Lecciones de vuelo
Mobile Day - Lecciones de vueloMobile Day - Lecciones de vuelo
Mobile Day - Lecciones de vuelo
 
S01.s1 - Lenguaje Java-1.pdf
S01.s1 - Lenguaje Java-1.pdfS01.s1 - Lenguaje Java-1.pdf
S01.s1 - Lenguaje Java-1.pdf
 
Planificación en inteligencia artificial aplicada a la robótica
Planificación en inteligencia artificial aplicada a la robóticaPlanificación en inteligencia artificial aplicada a la robótica
Planificación en inteligencia artificial aplicada a la robótica
 
Servidores de mapas en alta disponibilidad CyLiconValley
Servidores de mapas en alta disponibilidad CyLiconValleyServidores de mapas en alta disponibilidad CyLiconValley
Servidores de mapas en alta disponibilidad CyLiconValley
 
Jade 1 Agents principios básicos
Jade 1 Agents principios básicosJade 1 Agents principios básicos
Jade 1 Agents principios básicos
 
introduccion-a-las-aplicaciones-web-y-tecnologia-java.ppt
introduccion-a-las-aplicaciones-web-y-tecnologia-java.pptintroduccion-a-las-aplicaciones-web-y-tecnologia-java.ppt
introduccion-a-las-aplicaciones-web-y-tecnologia-java.ppt
 
Webinar interlat apps_2012_carlos_a-perez_españa
Webinar interlat apps_2012_carlos_a-perez_españaWebinar interlat apps_2012_carlos_a-perez_españa
Webinar interlat apps_2012_carlos_a-perez_españa
 
Webinar interlat apps_2012_carlos_a-perez_españa
Webinar interlat apps_2012_carlos_a-perez_españaWebinar interlat apps_2012_carlos_a-perez_españa
Webinar interlat apps_2012_carlos_a-perez_españa
 
APPS Aplicaciones móviles: Construyendo y publicando nuestro primera APPS mul...
APPS Aplicaciones móviles: Construyendo y publicando nuestro primera APPS mul...APPS Aplicaciones móviles: Construyendo y publicando nuestro primera APPS mul...
APPS Aplicaciones móviles: Construyendo y publicando nuestro primera APPS mul...
 
Java Web - Presentación
Java Web - PresentaciónJava Web - Presentación
Java Web - Presentación
 

Plus de Javier Gonzalez-Sanchez

Plus de Javier Gonzalez-Sanchez (20)

201804 SER332 Lecture 01
201804 SER332 Lecture 01201804 SER332 Lecture 01
201804 SER332 Lecture 01
 
201801 SER332 Lecture 03
201801 SER332 Lecture 03201801 SER332 Lecture 03
201801 SER332 Lecture 03
 
201801 SER332 Lecture 04
201801 SER332 Lecture 04201801 SER332 Lecture 04
201801 SER332 Lecture 04
 
201801 SER332 Lecture 02
201801 SER332 Lecture 02201801 SER332 Lecture 02
201801 SER332 Lecture 02
 
201801 CSE240 Lecture 26
201801 CSE240 Lecture 26201801 CSE240 Lecture 26
201801 CSE240 Lecture 26
 
201801 CSE240 Lecture 25
201801 CSE240 Lecture 25201801 CSE240 Lecture 25
201801 CSE240 Lecture 25
 
201801 CSE240 Lecture 24
201801 CSE240 Lecture 24201801 CSE240 Lecture 24
201801 CSE240 Lecture 24
 
201801 CSE240 Lecture 23
201801 CSE240 Lecture 23201801 CSE240 Lecture 23
201801 CSE240 Lecture 23
 
201801 CSE240 Lecture 22
201801 CSE240 Lecture 22201801 CSE240 Lecture 22
201801 CSE240 Lecture 22
 
201801 CSE240 Lecture 21
201801 CSE240 Lecture 21201801 CSE240 Lecture 21
201801 CSE240 Lecture 21
 
201801 CSE240 Lecture 20
201801 CSE240 Lecture 20201801 CSE240 Lecture 20
201801 CSE240 Lecture 20
 
201801 CSE240 Lecture 19
201801 CSE240 Lecture 19201801 CSE240 Lecture 19
201801 CSE240 Lecture 19
 
201801 CSE240 Lecture 18
201801 CSE240 Lecture 18201801 CSE240 Lecture 18
201801 CSE240 Lecture 18
 
201801 CSE240 Lecture 17
201801 CSE240 Lecture 17201801 CSE240 Lecture 17
201801 CSE240 Lecture 17
 
201801 CSE240 Lecture 16
201801 CSE240 Lecture 16201801 CSE240 Lecture 16
201801 CSE240 Lecture 16
 
201801 CSE240 Lecture 15
201801 CSE240 Lecture 15201801 CSE240 Lecture 15
201801 CSE240 Lecture 15
 
201801 CSE240 Lecture 14
201801 CSE240 Lecture 14201801 CSE240 Lecture 14
201801 CSE240 Lecture 14
 
201801 CSE240 Lecture 13
201801 CSE240 Lecture 13201801 CSE240 Lecture 13
201801 CSE240 Lecture 13
 
201801 CSE240 Lecture 12
201801 CSE240 Lecture 12201801 CSE240 Lecture 12
201801 CSE240 Lecture 12
 
201801 CSE240 Lecture 11
201801 CSE240 Lecture 11201801 CSE240 Lecture 11
201801 CSE240 Lecture 11
 

Dernier

redes informaticas en una oficina administrativa
redes informaticas en una oficina administrativaredes informaticas en una oficina administrativa
redes informaticas en una oficina administrativa
nicho110
 

Dernier (10)

Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21
 
Guia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos BasicosGuia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos Basicos
 
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
 
redes informaticas en una oficina administrativa
redes informaticas en una oficina administrativaredes informaticas en una oficina administrativa
redes informaticas en una oficina administrativa
 
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxEVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
 
investigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXIinvestigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXI
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvana
 
Buenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptxBuenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptx
 
How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estos
 

200710 - Java para dispositivos móviles

  • 1. /** * Java * para Dispositivos Móviles */ public class { public static void main (String [] a) { MCs. Javier González Sánchez; javiergs@itesm.mx; ITESM, campus Guadalajara; } }
  • 2. g.drawString(“ Agenda” ); agenda[ 1 Dispositivos móviles ]=“ ”; agenda[ 2 Java micro-edition ]= ”); agenda[ 3 programación con objetos y Java ]= agenda[ 4 MIDlet.HolaMundo ]= agenda[ 5 MIDlet.widgets ]= agenda[ 6 MIDlet.canvas ]= agenda[ 7 MIDlet.red ]= agenda[ 8 MIDlet.conclusiones ]= ”); javiergs@itesm.mx
  • 3. agenda[ 1 Dispositivos móviles ]= ”); • SMS (Short Service Message Service). Mensajes de máximo 160 caracteres • WAP y WML. Web de baja fiabilidad, velocidad y alto costo. • GPRS (General Packet Radio Service) transferencia de datos multimedia con cualidades aceptables. • MMS (Multimedia Message Service) • J2ME (Java 2 micro-edition) entorno de desarrollo Archivos JAR y JAD • Symbian: sistema operativo: Nokia, sony-ericsson, Motorola Archivos SIS javiergs@itesm.mx
  • 4. g.drawString(“ Agenda” ); agenda[ 1 Dispositivos móviles ]=“ ”; agenda[ 2 Java micro-edition ]= ”); agenda[ 3 programación con objetos y Java ]= agenda[ 4 MIDlet.HolaMundo ]= agenda[ 5 MIDlet.widgets ]= agenda[ 6 MIDlet.canvas ]= agenda[ 7 MIDlet.red ]= agenda[ 8 MIDlet.conclusiones ]= ”); javiergs@itesm.mx
  • 5. agenda[ 2 historia de Java ]=“ ”; Diciembre 1990: • Green Project, Oak, Duke … http://today.java.net/jag/old/green/ Octubre 2004: • Portafolio de productos basados en la red y con la filosofía de que el mismo software debe ser ejecutable en diferentes dispositivos y/o sistemas. • J2SE = base de la tecnología Java • J2EE = entorno empresarial, redes, acceso a datos • J2ME = entornos limitados javiergs@itesm.mx
  • 6. agenda[ 2 Java2.inicio() ]= ”); MIDlets Applets Servlet Aplicación gráfica JSP Aplicación texto Java Beans javiergs@itesm.mx
  • 7. agenda[ 2 J2ME.MIDlets ]= (“ Mobile Java ”); Java 2 Micro Edition • Omite el soporte a operaciones con punto flotante y los tipos de datos que manejan esa información • Limita el número de Exception disponibles para control de Errores • Para dispositivos con Configuración CLDC (Connected Limited Device Configuration): PDAs y teléfonos móviles. Y el caso particular de teléfonos móviles el perfil MIDP (Móvil Information Device Profile) • Maquina Virtual minimizada (K Virtual Machine) javiergs@itesm.mx
  • 8. agenda[ 2 J2ME.MIDlets ]= (“ Mobile Java ”); MIDlet: • programa capaz de ejecutarse en un dispositivo móvil. Herramientas de trabajo: • J2ME Wireless Toolkit 2.5 [http://java.sun.com/j2me/download.html ] • J2SE SDK es necesario como base. javiergs@itesm.mx
  • 9. g.drawString(“ Agenda” ); agenda[ 1 Dispositivos móviles ]=“ ”; agenda[ 2 Java micro-edition ]= ”); agenda[ 3 programación con objetos y Java ]= agenda[ 4 MIDlet.HolaMundo ]= agenda[ 5 MIDlet.widgets ]= agenda[ 6 MIDlet.canvas ]= agenda[ 7 MIDlet.red ]= agenda[ 8 MIDlet.conclusiones ]= ”); javiergs@itesm.mx
  • 10. agenda[ 3 programación ]=“ ”; • Variables, Tipos de dato, Operadores • Clases, Objetos • Atributos, Métodos • Paquetes, APIs • Herencia, Sobrecarga, Sobreescritura • Estructuras de control • Excepciones • Estructuras de Datos: arreglos javiergs@itesm.mx
  • 11. agenda[ 3 modelar el mundo real ”; ]=“ Clase = molde Objeto = cosa herencia se usar Son hijos de se tienen atributos se usan metodos atributos metodos tienen javiergs@itesm.mx
  • 12. agenda[ 3]=“ a trabajar … ”; class Coche { int velocidad; void acelerar( int nuevaVelocidad) { velocidad = nuevaVelocidad; } void frenar() { velocidad = 0; } } class Mundo { public static void main (String [] arg) { Coche miCoche = new Coche(); miCoche.acelerar(100); miCoche.frenar(); } } javiergs@itesm.mx
  • 13. agenda[ 3]=“ y se puede complicar … ”; class Coche extends Bicicleta{ int velocidad; void acelerar( int nuevaVelocidad) { velocidad = nuevaVelocidad; } void frenar() { velocidad = 0; } } class Mundo { public static void main (String [] arg) { Coche miCoche = new Coche(); miCoche.acelerar(100); miCoche.frenar(); } } javiergs@itesm.mx
  • 14. agenda[ 3] =“ compilar y ejecutar … ”; archivo.java archivo.class javiergs@itesm.mx
  • 15. g.drawString(“ Agenda” ); agenda[ 1 Dispositivos móviles ]=“ ”; agenda[ 2 Java micro-edition ]= ”); agenda[ 3 programación con objetos y Java ]= agenda[ 4 MIDlet.HolaMundo ]= agenda[ 5 MIDlet.widgets ]= agenda[ 6 MIDlet.canvas ]= agenda[ 7 MIDlet.red ]= agenda[ 8 MIDlet.conclusiones ]= ”); javiergs@itesm.mx
  • 16. agenda[ 4 J2ME.Wireless Toolkit ]= ”); project:package Device:emulador *.jar Build *.jad Run javiergs@itesm.mx
  • 17. agenda[ 4 J2ME.MIDlets ]= (“ Mobile Java ”); import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloWorld extends MIDlet implements CommandListener { private Command exitCommand; private Display display; private Form screen; public HelloWorld() { // Obtenemos el objeto Display del midlet. display = Display.getDisplay(this); // Creamos el comando Salir. exitCommand = new Command("Salir", Command.EXIT,2); // Creamos la pantalla principal (un formulario) screen = new Form("HelloWorld"); // Creamos y añadimos la cadena de texto a la pantalla StringItem saludo = new StringItem("","Hola Mundo..."); screen.append(saludo); // Añadimos el comando Salir e indicamos que clase lo manejará screen.addCommand(exitCommand); screen.setCommandListener(this); } javiergs@itesm.mx
  • 18. agenda[ 4 J2ME.MIDlets ]= (“ Mobile Java ”); public void startApp() throws MIDletStateChangeException { // Seleccionamos la pantalla a mostrar display.setCurrent(screen); } public void pauseApp() { } public void destroyApp(boolean incondicional) { } public void commandAction(Command c, Displayable s) { // Salir if (c == exitCommand) { destroyApp(false); notifyDestroyed(); } } } javiergs@itesm.mx
  • 19. agenda[ 4 Opciones ]= ”); Sony-ericsson SDK Archivo.jar Nokia Suite Archivo.jad etc. javiergs@itesm.mx
  • 20. agenda[ 4 Opciones ]= ”); javiergs@itesm.mx
  • 21. agenda[ 4 MIDlets ]= (“ anatomía ”); Hijo de: javax.microedition.midlet.MIDlet Sobrescribir: • startApp() • pauseApp() • destroyApp() Listener: • commandAction() CLDC (Connected Limited Device Configuration): • java.lang • java.util • java.io • Generic Conection Framework javiergs@itesm.mx
  • 22. agenda[ 4 MIDlets ]= (“ anatomía ”); MIDP (Móvil Information Device Profile) • javax.microedition.midlet Contiene la clase MIDlet • javax.microedition.lcdui Interfase de usuario: Screen, Canvas • javax.microedition.io • javax.microedition.rms • Timer • TimerTask javiergs@itesm.mx
  • 23. agenda[ 4 MIDlets ]= (“ fisiología ”); Display display = Display.getDisplay(this); Command exitCommand = new Command("Salir", Command.EXIT,2); Tipos de comandos disponibles: OK, CANCEL, BACK, STOP, HELP, SCREEN, ITEM. Form screen = new Form("HelloWorld"); screen.addCommand(exitCommand); screen.setCommandListener(this); StringItem saludo = new StringItem("","Hola Mundo..."); screen.append(saludo); display.setCurrent(screen); javiergs@itesm.mx
  • 24. g.drawString(“ Agenda” ); agenda[ 1 Dispositivos móviles ]=“ ”; agenda[ 2 Java micro-edition ]= ”); agenda[ 3 programación con objetos y Java ]= agenda[ 4 MIDlet.HolaMundo ]= agenda[ 5 MIDlet.widgets ]= agenda[ 6 MIDlet.canvas ]= agenda[ 7 MIDlet.red ]= agenda[ 8 MIDlet.conclusiones ]= ”); javiergs@itesm.mx
  • 25. agenda[ 4 MIDlets ]= (“ Screen ”); javiergs@itesm.mx
  • 26. agenda[ 4 MIDlets ]= (“ Screen ”); Las clases que heredan de Screen pueden aparecer en pantalla Solo una a la vez Heredan: • String getTitle() // devuelve el título de la pantalla • void setTitle(String s) // establece el título de la pantalla • Ticker getTicker() // Devuelve el ticker de la pantalla • void setTicker(Ticker ticker) // Establece el ticker de la pantalla Podemos generar varios objetos e intercalarlos display.setCurrent(objeto); javiergs@itesm.mx
  • 27. agenda[ 4 MIDlets ]= (“ Alert ”); Permite mostrar una pantalla de texto hasta que se produzca un comando de tipo OK. Se utiliza para mostrar mensajes de error y Avisos Alert ( String título, String texto_alerta, Image imagen_alerta, //null para no utilizar imagen AlertType tipo_alerta); //ALARM, CONFIRMATION, ERROR, INFO, WARNING Ejemplo: Alert alerta; alerta = new Alert ("Error","El dato no es válido", null,AlertType.ERROR); display.setCurrent(alerta); alerta.setTimeout(Alert.FOREVER); // tiempo en ms o establecer permante javiergs@itesm.mx
  • 28. agenda[ 4 MIDlets ]= (“ List ”); Crear listas de elementos seleccionables List ( String título, int tipo_lista, // EXCLUSIVE, IMPLICIT, MULTIPLE String[] elementos, image[] imágenes) Ejemplo: String[] ciudades = {"Málaga", "Madrid", "Melilla"}; List lista = new List ("Seleccione ciudad", List.EXCLUSIVE, ciudades, null); .. Lista.getString ( lista.getSelectedIndex() ); javiergs@itesm.mx
  • 29. agenda[ 4 MIDlets ]= (“ TextBox ”); Permite introducir y editar texto a pantalla completa TextBox ( String título, String texto, // texto inicial a desplegar int tamaño_max, // en caracteres int limitación) // ANY, EMAILADDR, NUMERIC, PASSWORD, PHONENUMBER, URL Ejemplo: TextBox texto = new TextBox ("Mensaje", "", 256, TextField.ANY); javiergs@itesm.mx
  • 30. agenda[ 4 MIDlets ]= (“ Form ”); Es un contenedor, aglutina una serie de elementos visuales Ejemplo: StringItem saludo = new StringItem("","Hola Mundo..."); Form screen.append(saludo); javiergs@itesm.mx
  • 31. agenda[ 4 MIDlets ]= (“ Form ”); Métodos: • append(Item) • delete(int) • insert(int, Item) • set(int, Item) • size() Listener: • ItemstateListener • formulario.setItemStateListener(this); • void itemStateChanged(Item elemento) javiergs@itesm.mx
  • 32. agenda[ 4 MIDlets ]= (“ Item ”); StringItem (String etiqueta, String texto) String getText() void setText(String texto) ImageItem (String etiqueta, Image img, int layout, // posicion LAYOUT_DEFAULT, LAYOUT_LEFT .. String texto_alternativo) //a mostrar en vez de la imagen *las imágenes se colocan en el directorio res TextField ( String etiqueta, String texto, int tamaño_max, int limitación) javiergs@itesm.mx
  • 33. agenda[ 4 MIDlets ]= (“ Item ”); DateField ( String etiqueta, int modo) // DATE, TIME, DATE_TIME Date getDate() void setDate (Date fecha) ChoiceGroup ( String etiqueta, int tipo_lista, String[] elementos, image[] imágenes) Gauge ( String etiqueta, bolean interactivo, //permitir modificar al usr int val_max, int val_ini) * Barra de estado javiergs@itesm.mx
  • 34. agenda[ 4 MIDlets ]= (“ Item ”); import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Items extends MIDlet implements CommandListener { private Command exitCommand; private Display display; private Form screen; public Items() { String[] estados = {"Casado","Soltero","Divorciado","Viudo"}; display = Display.getDisplay(this); exitCommand = new Command("Salir", Command.EXIT,2); screen = new Form("Interfaz de usuario"); TextField nombre = new TextField("Nombre","",30,TextField.ANY); DateField fecha_nac = new DateField("Fecha de nacimiento", DateField.DATE); ChoiceGroup estado = new ChoiceGroup("Estado",List.EXCLUSIVE,estados,null); screen.append(nombre); screen.append(fecha_nac); screen.append(estado); screen.addCommand(exitCommand); screen.setCommandListener(this); } javiergs@itesm.mx
  • 35. agenda[ 4 MIDlets ]= (“ Item ”); public void startApp() throws MIDletStateChangeException { // Seleccionamos la pantalla a mostrar display.setCurrent(screen); } public void pauseApp() { } public void destroyApp(boolean incondicional) { } public void commandAction(Command c, Displayable s) { // Salir if (c == exitCommand) { destroyApp(false); notifyDestroyed(); } } } javiergs@itesm.mx
  • 36. g.drawString(“ Agenda” ); agenda[ 1 Dispositivos móviles ]=“ ”; agenda[ 2 Java micro-edition ]= ”); agenda[ 3 programación con objetos y Java ]= agenda[ 4 MIDlet.HolaMundo ]= agenda[ 5 MIDlet.widgets ]= agenda[ 6 MIDlet.canvas ]= agenda[ 7 MIDlet.red ]= agenda[ 8 MIDlet.conclusiones ]= ”); javiergs@itesm.mx
  • 37. agenda[ 4 MIDlets ]= (“ canvas ”); import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Canvas1 extends MIDlet implements CommandListener { private Command exitCommand; private Display display; private SSCanvas screen; public Canvas1() { display=Display.getDisplay(this); exitCommand = new Command("Salir",Command.SCREEN,2); screen=new SSCanvas(); screen.addCommand(exitCommand); screen.setCommandListener(this); } public void startApp() throws MIDletStateChangeException { display.setCurrent(screen); } public void pauseApp() {} public void destroyApp(boolean unconditional) {} public void commandAction(Command c, Displayable s) { if (c == exitCommand) { destroyApp(false); notifyDestroyed(); } } } javiergs@itesm.mx
  • 38. agenda[ 4 MIDlets ]= (“ canvas ”); class SSCanvas extends Canvas { public void paint(Graphics g) { g.setColor(255,255,255); g.fillRect (0, 0, getWidth(), getHeight()); q.setColor(10,200,100); g.drawLine (0, 0, 100, 100); g.fillRect (50, 50, 30, 30); Image img = Image.createImage(“/logo.png"); g.drawImage (img, 10, 10, Graphics.HCENTER, Graphics.VCENTER); } } javiergs@itesm.mx
  • 39. agenda[ 4 juegos ]= ”); (1) Movimiento Animación Colisión Una clase que represente al avión y permita su manipulación javiergs@itesm.mx
  • 40. agenda[ 4 teclado ]= ”); // Lectura del Teclado: keyPressed(), keyReleased() y keyRepeated(). public void keyPressed(int keyCode) { int action = getGameAction(keyCode); switch (action) { case FIRE: // Disparar break; case LEFT: // Mover a la izquierda break; case RIGHT: // Mover a la derecha break; case UP: // Mover hacia arriba break; case DOWN: // Mover hacia abajo break; } } javiergs@itesm.mx
  • 41. agenda[ 4 hilos ]= ”); public void run() { iniciar(); while (true) { // Actualizar fondo de pantalla doScroll(); // Actualizar posición del jugador computePlayer(); // Actualizar pantalla repaint(); serviceRepaints(); try { Thread.sleep(sleepTime); Y el teclado } catch (InterruptedException e) { } Con sus Pseudo- listeners } } javiergs@itesm.mx
  • 42. g.drawString(“ Agenda” ); agenda[ 1 Dispositivos móviles ]=“ ”; agenda[ 2 Java micro-edition ]= ”); agenda[ 3 programación con objetos y Java ]= agenda[ 4 MIDlet.HolaMundo ]= agenda[ 5 MIDlet.widgets ]= agenda[ 6 MIDlet.canvas ]= agenda[ 7 MIDlet.red ]= agenda[ 8 MIDlet.conclusiones ]= ”); javiergs@itesm.mx
  • 43. agenda[ 4 MIDlets ]= (“ red ”); try { c = (HttpConnection)Connector.open(url); c.setRequestMethod(HttpConnection.GET); c.setRequestProperty("IF-Modified-Since", "10 Nov 2000 17:29:12 GMT"); c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/ CLDC-1.0"); c.setRequestProperty("Content-Language", "es-ES"); is = c.openInputStream(); int ch, i, j; // leer los datos desde la URL while ((ch = is.read()) != -1) { b.append((char) ch); } // mostrar noticias en la pantalla t = new TextBox("Noticias en barrapunto.com", salida.toString(), 1024, 0); javiergs@itesm.mx
  • 44. g.drawString(“ Agenda” ); agenda[ 1 Dispositivos móviles ]=“ ”; agenda[ 2 Java micro-edition ]= ”); agenda[ 3 programación con objetos y Java ]= agenda[ 4 MIDlet.HolaMundo ]= agenda[ 5 MIDlet.widgets ]= agenda[ 6 MIDlet.canvas ]= agenda[ 7 MIDlet.red ]= agenda[ 8 MIDlet.conclusiones ]= ”); javiergs@itesm.mx
  • 45. System.out.println(“ Conclusiones ”); Java World javiergs@itesm.mx
  • 46. out.println(“ Referencias ”); mucho public interface J2 { por http://java.sun.com; http://www.java.com; aprender http://java.net && } seguir trabajando public interface J2ME extends J2 { http://java.sun.con/j2me/ } public interface Otros extends J2 { http://www.symbian.com/ http://developer.sonyericsson.com/ } javiergs@itesm.mx
  • 47. out.println(“ Para divertirse ”); A jugar! public interface Nintendo en tu celular { http://www.ba-k.com/ index.php?/archives/ 710-Vnes-1.20-JUEGA-NINTENDO-EN-TU-CELULAR.html; } public interface VNES for J2ME { http://www.vampent.com/vnes.htm; } javiergs@itesm.mx
  • 48. super(“ ¡ Gracias 2007 !”); public stop () { http:// www.javiergs.com javiergs@itesm.mx } javiergs@itesm.mx