Blogia

guille9020

Esta es la version 2

import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import javax.microedition.rms.*;

public class Clientes2 extends MIDlet implements CommandListener {
    static final String BD = "datos";
    private String url = "http://alucardlol.vacau.com/sitior/cambio/cambio.php?rmoneda=";

    String nc = "Dolares";
    String tmoneda = "dolar";
    private Command cmdVer;

    TextBox t=null;
    Cliente c = new Cliente();

    private ChoiceGroup moneda;
    private ChoiceGroup pesos;
    public  TextField txtPesos;
    private Display pantalla;

    private Form frmAgregar;
    private Command cmdGuardar;
    private Command cmdCancelar;
    private TextField nombre;
    private TextField descuento;

    private Form frmEliminar;
    private Command cmdEliminar;
    private TextField nombre2;

    private Form frmBuscar;
    private Command cmdBuscar;
    private TextField nombre3;

    private Form frmResultados;
    public int itemResultados;

    private List elmenu;
    private Command cmdSalir;
    private Command cmdSeleccionar;

    private Form frmConeccion;
    private Command cmdRegresar;
    private TextField txtcantidadmoneda;

    public Clientes2() {
    //    Prepara Display
    pantalla = Display.getDisplay(this);
    //    Prepara Base de Datos
    RecordStore rs = null;
    try
    {
        RecordStore.deleteRecordStore(BD);
    }
    catch( Exception e ){}
    try
    {
    rs = RecordStore.openRecordStore(BD, true);
    rs.closeRecordStore();
    }
    catch( RecordStoreException e )
    {
    System.out.println( e );
    }
      // menu principal
        String opciones[] = {"Añadir", "Eliminar", "Busqueda", "Cambio."};
        Image figuras[] = new Image[4];
        try
        {
            figuras[0] = Image.createImage("/nuevo.png");
            figuras[1] = Image.createImage("/borrar.png");
            figuras[2] = Image.createImage("/buscar.png");
            figuras[3] = Image.createImage("/acercade.png");
        }
        catch (Exception e){}
        cmdSeleccionar = new Command("Seleccionar",Command.ITEM,1);
        cmdSalir = new Command("Salir", Command.EXIT,1);
        elmenu = new List("Sistema Movil", Choice.IMPLICIT,opciones,figuras);
        elmenu.setSelectCommand(cmdSeleccionar);
        elmenu.addCommand(cmdSalir);
        elmenu.setCommandListener(this);
        //Añadir
        cmdGuardar = new Command("Guardar",Command.OK,2);
        cmdCancelar = new Command("Cancelar", Command.BACK,2);
        frmAgregar = new Form("Añadir Cliente");
        nombre = new TextField("Nombre:","",30,TextField.ANY);
        descuento = new TextField("Cantidad:","",4,TextField.NUMERIC);
        frmAgregar.append(nombre);
        frmAgregar.append(descuento);
        frmAgregar.addCommand(cmdGuardar);
        frmAgregar.addCommand(cmdCancelar);
        frmAgregar.setCommandListener(this);

        moneda = new ChoiceGroup("Tipo Moneda", Choice.EXCLUSIVE);
        moneda.append("Dolares", null);
        moneda.append("Euros", null);
        moneda.append("Yenes", null);
         frmAgregar.append(moneda);
        //Eliminar
        cmdEliminar = new Command("Eliminar", Command.OK,2);
        frmEliminar = new Form("Eliminar Cliente");
        nombre2 = new TextField("Nombre:","",20,TextField.ANY);
        frmEliminar.append(nombre2);
        frmEliminar.addCommand(cmdEliminar);
        frmEliminar.addCommand(cmdCancelar);
        frmEliminar.setCommandListener(this);
        //Buscar
        cmdBuscar = new Command("Buscar", Command.OK,2);
        frmBuscar = new Form ("Buscar Cliente");
        nombre3 = new TextField("Nombre:","",20,TextField.ANY);
        frmBuscar.append(nombre3);
        frmBuscar.addCommand(cmdBuscar);
        frmBuscar.addCommand(cmdCancelar);
        frmBuscar.setCommandListener(this);
        //Resultados De Busqueda
        cmdRegresar = new Command("OK",Command.BACK,1);
        frmResultados = new Form("Resultados");
        itemResultados = frmResultados.append("Resultados");
        frmResultados.addCommand(cmdRegresar);
        frmResultados.setCommandListener(this);
        //Acerca De...
        cmdVer =  new Command("Ver", Command.OK,2);
        frmConeccion = new Form ("Conectado con Dolares");
        txtcantidadmoneda = new TextField("Dolares:","",10,TextField.ANY);
        pesos = new ChoiceGroup("Tipo Moneda", Choice.EXCLUSIVE);
        pesos.append("Dolares", null);
        pesos.append("Euros", null);
        pesos.append("Yenes", null);
        frmConeccion.addCommand(cmdVer);
        frmConeccion.append(pesos);
        frmConeccion.append(txtcantidadmoneda);
        frmConeccion.addCommand(cmdCancelar);
        frmConeccion.setCommandListener(this);

    }
    public void startApp() throws MIDletStateChangeException {
        pantalla.setCurrent(elmenu);
    }
 public void download (String url) throws IOException{
        txtPesos = new TextField("Nombre", "Guillermo Castro", 10, TextField.ANY);

        StringBuffer b= new StringBuffer();
        InputStream is=null;
        HttpConnection c=null;
        String mostrar = "";
        try {
            long len =0;
            int ch=0;

            c= (HttpConnection)Connector.open(url);
            is = c.openInputStream();
            while ((ch=is.read()) !=-1){
                b.append((char)ch);
            }
            txtcantidadmoneda.setString( b.toString().substring(0, 6));

          } finally {
              if(is !=null)
                  is.close();
              if(c !=null)
                  c.close();
          }
          //pantalla.setCurrent(t);
    }
    public void pauseApp() {
    }
    public void destroyApp(boolean unconditional) {
    }
    public void commandAction(Command c, Displayable s)
    {
        if(c == cmdVer)
                {
                    if(pesos.isSelected(0))
                     {
                         frmConeccion.setTitle("Conectado con Dolares");
                         url = "http://alucardlol.vacau.com/sitior/cambio/cambio.php?rmoneda=";
                         try{
                                download(url);
                            } catch(IOException e){
                                System.out.println("IOException" + e);
                            }
                     }
                     else if(pesos.isSelected(1))
                     {
                        pantalla.setCurrent(frmConeccion);
                         frmConeccion.setTitle("Conectado con Euros");
                         url = "http://alucardlol.vacau.com/sitior/cambio/cambio.php?rmoneda=";
                         try{
                                download(url);
                            } catch(IOException e){
                                System.out.println("IOException" + e);
                            }
                     }
                     else if(pesos.isSelected(2))
                     {
                       frmConeccion.setTitle("Conectado con Yens");
                       url = "http://alucardlol.vacau.com/sitior/cambio/cambio.php?rmoneda=";
                       try{
                                download(url);
                            } catch(IOException e){
                                System.out.println("IOException" + e);
                            }
                     }
                }
        switch(c.getCommandType())
        {
            case Command.ITEM:
                switch(elmenu.getSelectedIndex())
                {
                    case 0://añadir
                        pantalla.setCurrent(frmAgregar);
                        break;
                    case 1://Eliminar
                        pantalla.setCurrent(frmEliminar);
                        break;
                    case 2://Buscar
                        pantalla.setCurrent(frmBuscar);
                        break;
                    case 3://Acerca De...
                        pantalla.setCurrent(frmConeccion);

                          pantalla = Display.getDisplay(this);
                            try{
                                download(url);
                            } catch(IOException e){
                                System.out.println("IOException" + e);
                            }
                        break;
                }
                break;
            case Command.EXIT:
                destroyApp(false);
                notifyDestroyed();
                break;
            case Command.BACK:
                pantalla.setCurrent(elmenu);
                limpiar();
                break;
            case Command.OK:
                if (c == cmdGuardar)
                {
                    this.c.nombre = nombre.getString();
                    this.c.descuento = Long.parseLong(descuento.getString());
                    this.c.moneda =  "Vacio";

                    if(moneda.isSelected(0))
                     {
                         elmenu.setTitle(moneda.getString(0));
                         this.c.moneda =  moneda.getString(0);
                        this.c.pesos = this.c.descuento*13;
                     }
                     else if(moneda.isSelected(1))
                     {
                         elmenu.setTitle(moneda.getString(1));
                         this.c.moneda =  moneda.getString(1);
                        this.c.pesos = this.c.descuento*18;
                     }
                     else if(moneda.isSelected(2))
                     {
                         elmenu.setTitle(moneda.getString(2));
                         this.c.moneda =  moneda.getString(2);
                          this.c.pesos = this.c.descuento*2;
                     }
                    this.c.agregar();
                    limpiar();
                    pantalla.setCurrent(elmenu);
                }
                else if(c == cmdEliminar)
                {
                    this.c.nombre = nombre2.getString();
                    frmResultados.delete(itemResultados);
                    itemResultados = frmResultados.append(this.c.eliminar());
                    limpiar();
                    pantalla.setCurrent(frmResultados);
                }
                else if(c == cmdBuscar)
                {
                    this.c.nombre = nombre3.getString();
                    frmResultados.delete(itemResultados);
                    itemResultados = frmResultados.append(this.c.buscar());
                    limpiar();
                    pantalla.setCurrent(frmResultados);
                }
                break;
        }
    }
    void limpiar()
    {
        nombre.setString("");
        nombre2.setString("");
        nombre3.setString("");
        descuento.setString("");
//        txtcantidadmoneda.setString("");
    }
class Cliente
{
    public String clave;
    public String nombre;
    private long descuento;
        private long pesos;
        private  String moneda;
        //Agregar
    public void agregar()
    {
        RecordStore rs = null;
        try
        {
            rs = RecordStore.openRecordStore(BD,false);
            RecordEnumeration registros = rs.enumerateRecords(null, null, false);

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            DataOutputStream os = new DataOutputStream(baos);
            try
            {
                os.writeUTF(nombre);
                os.writeLong(descuento);
                                os.writeLong(pesos);
                                os.writeUTF(moneda);
                os.flush();
            }
            catch (IOException ioe) {}

            byte[] b = baos.toByteArray();
            try
            {
                rs.addRecord(b, 0, b.length);
            }
            catch (RecordStoreException rse) {}
            rs.closeRecordStore();
        }
        catch( RecordStoreException e ){}
    }
              //Eliminar
        public String eliminar()
                        {
                        int indice;
                        RecordStore rs = null;
                        String texto = "No se encontro el registro";
                        try
                        {
                        rs = RecordStore.openRecordStore(BD, false);
                        RecordEnumeration registros = rs.enumerateRecords(null, null, false);
                        while (registros.hasNextElement())
                        {
                        indice=registros.nextRecordId();
                        try
                        {
                            ByteArrayInputStream bais = new ByteArrayInputStream(rs.getRecord(indice));
                            DataInputStream is = new DataInputStream(bais);
                        try
                        {
                            clave = is.readUTF();
                        }
                        catch (EOFException eofe) {}
                        catch (IOException ioe) {}
                        if (clave.equals(this.nombre))
                        {
                        try
                        {
                        rs.deleteRecord(indice);
                        texto = "El registro"+indice+"ha sido eliminado";
                        }
                        catch(InvalidRecordIDException e){}
                        }
                        }
                        catch (RecordStoreException e) {}
                        }
                        rs.closeRecordStore();
                        }
                        catch( RecordStoreException e ){}
                        return texto;
                            }
                    //Buscar
                    public String buscar()
                    {
                    String texto = "";
                    String elnornbre;
                    String moneda;

                    long cantidad;
                    long pesos;
                    boolean eureka = false;
                    RecordStore rs = null;
                    int indice;
                    try
                    {
                        rs = RecordStore.openRecordStore(BD, false);
                        RecordEnumeration registros = rs.enumerateRecords(null, null, false);
                        while (registros.hasNextElement())
                        {
                        indice=registros.nextRecordId();
                        try
                        {
                            ByteArrayInputStream bais = new ByteArrayInputStream(rs.getRecord(indice));
                            DataInputStream is = new DataInputStream(bais);
                            try
                            {
                                elnornbre = is.readUTF();
                                cantidad = is.readLong();
                                pesos = is.readLong();
                                moneda = is.readUTF();

                                if(this.nombre.equals("*") || this.nombre.equals("ALL"))
                                {
                                    texto += "INDICE: "+indice+"nCLIENTE: "+elnornbre+"nCANTIDAD:"+cantidad+"nMoneda: " +moneda+"nPesos: " +pesos+"nn";
                                    eureka = true;
                                }
                                else
                                {
                                    if (elnornbre.equals(nombre))
                                    {
                                        texto += "INDICE: "+indice+ "nCLIENTE: " +elnornbre+"nCANTIDAD:"+cantidad+"nMoneda: " +moneda+"nPesos: " +pesos+"nn";
                                        eureka = true;
                                    }
                                }
                            }
                            catch (EOFException eofe) {}
                            catch (IOException ice) {}
                            bais.reset();
                        }
                        catch (RecordStoreException e) {}
                        }
                            rs.closeRecordStore();
                        }
                    catch( RecordStoreException e ){}
                    if (!eureka)
                        texto = "No se encontro el registro";
                    return texto;
                    }
     }
}//clase Cliente

import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;

public class Clientes extends MIDlet implements CommandListener {
    static final String BD = "datos";
    Cliente c = new Cliente();

    private Display pantalla;

    private Form frmAgregar;
    private Command cmdGuardar;
    private Command cmdCancelar;
    private TextField nombre;
    private TextField descuento;

    private Form frmEliminar;
    private Command cmdEliminar;
    private TextField nombre2;

    private Form frmBuscar;
    private Command cmdBuscar;
    private TextField nombre3;

    private Form frmResultados;
    public int itemResultados;

    private List elmenu;
    private Command cmdSalir;
    private Command cmdSeleccionar;

    private Alert acercade;
    private Command cmdRegresar;

    public Clientes() {
      //----------------------------
      //      Prepara Display
      //----------------------------
        pantalla = Display.getDisplay(this);

      //---------------------------
      //      Prepara Base de datos
      //---------------------------
        RecordStore rs = null;
        
        try
        {
            RecordStore.deleteRecordStore(BD);
        }
        catch(Exception e){}
       
    try
    {
        rs = RecordStore.openRecordStore(BD, true);
        rs.closeRecordStore();
    }
    catch( RecordStoreException e)
    {
            System.out.println(e);
        }

        //---------------------------
        //      Menu Principal
        //---------------------------
        String opciones[] = {"añadir", "Eliminar", "Busqueda", "Acerca de..."};
        Image figuras[] = new Image[4];
        try
        {
            figuras[0] = Image.createImage("/nuevo.png");
            figuras[1] = Image.createImage("/borrar.png");
            figuras[2] = Image.createImage("/buscar.png");
            figuras[3] = Image.createImage("/acercade.png");
        }
        catch (Exception e){}
        cmdSeleccionar = new Command("Seleccionar", Command.ITEM,1);
        cmdSalir = new Command("Salir", Command.EXIT,1);
        elmenu = new List("Sistema Móvil", Choice.IMPLICIT,opciones,figuras);
        elmenu.setSelectCommand(cmdSeleccionar);
        elmenu.addCommand(cmdSalir);
        elmenu.setCommandListener(this);

        //------------------------
        //      Añadir
        //------------------------
        cmdGuardar = new Command("Guardar", Command.OK,2);
        cmdCancelar = new Command("Cancelar", Command.BACK,2);
        frmAgregar = new Form("Añadir cliente");
        nombre = new TextField("Descuento","",3,TextField.NUMERIC);
        frmAgregar.append(nombre);
        frmAgregar.append(descuento);
        frmAgregar.addCommand(cmdGuardar);
        frmAgregar.addCommand(cmdCancelar);
        frmAgregar.setCommandListener(this);

        //------------------------
        //      Eliminar
        //------------------------
        cmdEliminar = new Command("Eliminar", Command.OK,2);
        frmEliminar = new Form("Eliminar cliente");
        nombre2 = new TextField("Nombre","",20,TextField.ANY);
        frmEliminar.append(nombre2);
        frmEliminar.addCommand(cmdEliminar);
        frmEliminar.addCommand(cmdCancelar);
        frmEliminar.setCommandListener(this);

        //------------------------
        //      Buscar
        //------------------------
        cmdBuscar = new Command("Buscar", Command.OK,2);
        frmBuscar = new Form("Buscra cliente");
        nombre3 = new TextField("Nombre","",20,TextField.ANY);
        frmBuscar.append(nombre3);
        frmBuscar.addCommand(cmdBuscar);
        frmBuscar.addCommand(cmdCancelar);
        frmBuscar.setCommandListener(this);

        //---------------------------------
        //      Resultados de la busqueda
        //---------------------------------
        cmdRegresar = new Command("OK", Command.BACK,1);
        frmResultados = new Form("Resultados");
        itemResultados = frmResultados.append("Resultados");
        frmResultados.addCommand(cmdRegresar);
        frmResultados.setCommandListener(this);

        //------------------------
        //      Acerca de...
        //------------------------
        acercade = new Alert("Qiubo lobo");
        acercade.setTimeout(Alert.FOREVER);
        String creditos = "Hecho por: n Guillermo Castro";

        if (pantalla.numColors() > 2)
        {
            String icon = (pantalla.isColor()) ?"/JavaPowered-8.png": "JavaPowered-2.png";
            try
            {
                Image image = Image.createImage(icon);
                        acercade.setImage(image);
            }
            catch (java.io.IOException x){}
        }
        acercade.setString(creditos);
        acercade.addCommand(cmdRegresar);
        acercade.setCommandListener(this);
    }
    public void startApp() throws MIDletStateChangeException{
        pantalla.setCurrent(elmenu);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean incondicional) {
    }

    public void commandAction(Command c, Displayable s){
        switch(c.getCommandType())
        {
            case Command.ITEM:
                switch(elmenu.getSelectedIndex())
                {
                    case 0: //añadir
                        pantalla.setCurrent(frmAgregar);
                        break;

                    case 1: //Eliminar
                        pantalla.setCurrent(frmEliminar);
                        break;

                    case 2: //busqueda
                        pantalla.setCurrent(frmBuscar);
                        break;

                    case 3: //acerca de...
                        pantalla.setCurrent(acercade);
                        break;
                }
                break;
            case Command.EXIT:
              destroyApp(false);
              notifyDestroyed();
              break;
            case Command.BACK:
                pantalla.setCurrent(elmenu);
                limpiar();
                break;
            case Command.OK:
                if (c == cmdGuardar)
                {
                    this.c.nombre = nombre.getString();
                    this.c.descuento = Long.parseLong(descuento.getString());
                    this.c.agregar();
                    limpiar();
                    pantalla.setCurrent(elmenu);
                }
                else if(c == cmdEliminar)
                {
                    this.c.nombre = nombre2.getString();
                    frmResultados.delete(itemResultados);
                    itemResultados = frmResultados.append(this.c.eliminar());
                    limpiar();
                    pantalla.setCurrent(frmResultados);
                }
                else if(c == cmdBuscar)
                {
                    this.c.nombre = nombre3.getString();
                    frmResultados.delete(itemResultados);
                    itemResultados = frmResultados.append(this.c.buscar());
                    limpiar();
                    pantalla.setCurrent(frmResultados);
                }
                break;
        }
    }
    void limpiar()
    {
        nombre.setString("");
        nombre2.setString("");
        nombre3.setString("");
        descuento.setString("");
    }
    class Cliente
    {
            public String clave;
            public String nombre;
            public long descuento;

            public void agregar()
        {
                RecordStore rs = null;
                try
                {
                    rs = RecordStore.openRecordStore(BD, false);
                    RecordEnumeration registros = rs.enumerateRecords(null, null, false);

                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    DataOutputStream os = new DataOutputStream(baos);
                    try
                    {
                        os.writeUTF(nombre);
                        os.writeLong(descuento);
                        os.flush();
                    }
                    catch (IOException ioe) {}

                    byte[] b = baos.toByteArray();
                    try
                    {
                        rs.addRecord(b, 0, b.length);
                    }
                    catch (RecordStoreException rse) {}
                    rs.closeRecordStore();
            }
                catch(RecordStoreException e) {}
            }
            public String eliminar()
       {
                int indice;
                RecordStore rs = null;
                String texto = "No se encontro el registro";
                try
                {
                    rs = RecordStore.openRecordStore(BD, false);
                    RecordEnumeration registros = rs.enumerateRecords(null, null, false);

                    while (registros. hasNextElement())
           {
                    indice = registros.nextRecordId();
                    try
                    {
                            ByteArrayInputStream bais = new ByteArrayInputStream(rs.getRecord(indice));
                            DataInputStream is = new DataInputStream(bais);
                            try
                            {
                                clave = is.readUTF();
                            }
                            catch (EOFException eofe) {}
                            catch (IOException ioe) {}
                            if (clave.equals(this.nombre))
                            {
                                try
                                        {
                                             rs.deleteRecord(indice);
                                             texto = "El registro"+indice+"Ha sido eliminado";
                                           }
                                           catch(InvalidRecordIDException e) {}
                            }
                            }
                            catch(RecordStoreException e) {}
                }
                    rs.closeRecordStore();
            }
            catch(RecordStoreException e) {}
            return texto;
            }
        public String buscar()
        {
                String texto = "";
                String elnombre;
                long eldescto;
                boolean eureka = false;
                RecordStore rs = null;
                int indice;

                try
                {
                    rs = RecordStore.openRecordStore(BD, false);
                    RecordEnumeration registros = rs.enumerateRecords(null, null, false);
            while (registros.hasNextElement())
            {
                   indice = registros.nextRecordId();
                   try
                        {
                                ByteArrayInputStream bais = new ByteArrayInputStream(rs.getRecord(indice));
                                DataInputStream is = new DataInputStream(bais);
                                try
                                {
                                    elnombre = is.readUTF();
                                    eldescto = is.readLong();
                                    if(this.nombre.equals("*") || this.nombre.equals("ALL"))
                                    {
                                        texto += "Indice: "+indice+ "n CLIENTE: " +"nDESCUENTO: "+eldescto+"%nn";
                                        eureka = true;
                                    }
                                    else
                                    {
                                        if(elnombre.equals(nombre))
                                        {
                                            texto += "Indice: "+indice+ "n CLIENTE: " +"nDESCUENTO: "+eldescto+"%nn";
                                            eureka = true;
                                        }
                                    }
                                }
                                catch (EOFException eofe) {}
                                catch (IOException ioe) {}
                                bais.reset();
                                }
                        catch (RecordStoreException e) {}
                        }
                    rs.closeRecordStore();
                    }
                catch(RecordStoreException e){}
                if (!eureka)
                    texto = "No se encontro el registro";
                return texto;
                }
    }
}

Mis datos Http

Mis datos Http

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

public class Datos extends MIDlet implements CommandListener {

    Display display = null;
    List menu = null;
    TextBox t = null;
    private String url1 = "http://newworldpublic.vacau.com/jimmy/datos1.html";
    private String url2 = "http://newworldpublic.vacau.com/jimmy/datos.html";
    static final Command backCommand = new Command("Back", Command.BACK, 0);
    static final Command mainMenuCommand = new Command("Main", Command.SCREEN, 1);
    static final Command exitCommand = new Command("Exit", Command.STOP, 2);
    String currentMenu = null;

    public Datos() {
    }

    public void startApp() throws MIDletStateChangeException {
        display = Display.getDisplay(this);

        menu = new List("Mi informacion", Choice.IMPLICIT);
        menu.append("Mis datos", null);
        menu.append("Info extra", null);
        menu.addCommand(exitCommand);
        menu.setCommandListener(this);

        mainMenu();
    }

    void mainMenu() {
        display.setCurrent(menu);
        currentMenu = "Main";
    }

    public void misDatos() {
        try {
            download(url1);
        } catch (IOException e) {
            System.out.println("IOException: " + e);
        }
    }

    public void Infoextra() {
        try {
            download1(url2);
        } catch (IOException e) {
            System.out.println("IOException: " + e);
        }
    }

    private void download(String url1) throws IOException {
        StringBuffer b = new StringBuffer();
        InputStream is = null;
        HttpConnection c = null;

        try {
            long len = 0;
            int ch = 0;

            c = (HttpConnection) Connector.open(url1);
            is = c.openInputStream();

            while ((ch = is.read()) != -1) {
                b.append((char) ch);
            }

            t = new TextBox("Mis datos...", b.toString(), 1024, 0);
            t.addCommand(backCommand);
            t.setCommandListener(this);
        } finally {
            if (is != null) {
                is.close();
            }
            if (c != null) {
                c.close();
            }
        }
        display.setCurrent(t);
    }

    private void download1(String url2) throws IOException {
        StringBuffer b = new StringBuffer();
        InputStream is = null;
        HttpConnection c = null;
        try {
            long len = 0;
            int ch = 0;
            c = (HttpConnection) Connector.open(url2);
            is = c.openInputStream();
            while ((ch = is.read()) != -1) {
                b.append((char) ch);
            }
            t = new TextBox("Extra...", b.toString(), 1024, 0);
            t.addCommand(backCommand);
            t.setCommandListener(this);
        } finally {
            if (is != null) {
                is.close();
            }
            if (c != null) {
                c.close();
            }
        }
        display.setCurrent(t);
    }

    public void testItem1() {
        misDatos();
        currentMenu = "Mis datos";
    }

    public void testItem2() {
        Infoextra();
        currentMenu = "Info extra";
    }

    public void commandAction(Command c, Displayable d) {
        String label = c.getLabel();
        if (label.equals("Exit")) {
            destroyApp(true);
        } else if (label.equals("Back")) {
            mainMenu();
            if (currentMenu.equals("Mis datos") || currentMenu.equals("Info extra")) {
            }
        } else {
            List down = (List) display.getCurrent();
            switch (down.getSelectedIndex()) {
                case 0:
                    testItem1();
                    break;
                case 1:
                    testItem2();
                    break;
            }
        }
    }

    public void pauseApp() {
        display = null;
    menu = null;
    //input = null;
    }

    public void destroyApp(boolean incondicional) {
        notifyDestroyed();
    }
}

No puedo trepar todas las fotos profe y no utilice mi cel porque no lo soporto no se porque!! :$