• Martes 14 de Abril de 2026, 00:47

Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Mensajes - nordith

Páginas: [1]
1
Java / agenda en javaME
« en: Viernes 7 de Mayo de 2010, 13:37 »
Hola, quisiera saber si alguien me podria explicar por favor
como puedo implementar un arreglo para que me pueda guardar
los registros que ingreso para que no se pierdan al cerrar la
aplicacion, como es el caso de ingresar tu nombre y telefono
para una agenda, teniendo un dato ya guardado.
Piensa que seria en la parte de showInput y en Agregar.
Gracias



package Ejemplo;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.Display.*;
import javax.microedition.rms.*;
/**
 * @author Pantoja
 */
public class TextFieldExample extends MIDlet implements CommandListener{
   
    private Command Agregar;
    private Command agregar;
    private Command borrar;
    private Command salir;
    private Form form;
  private Display display;
  private TextField name, telefono, name1, telefono1;
  private Command ok;
        String n,s;
        private RecordStore rs;
int registro [] = new int [75];

  public TextFieldExample(){

     s = ("Registro 1 "+""+"n Nombre: "+"Antonio"+"n Telefono:"+"555123456");
      name = new TextField("Nombre:", "", 30, TextField.ANY);
    telefono = new TextField("Telefono:", "", 30, TextField.NUMERIC);

    ok = new Command("OK", Command.OK, 2);
    salir =new Command("Salir",Command.EXIT, 2);
    borrar =new Command("borrar",Command.EXIT, 2);
    agregar = new Command ("Agregar",Command.BACK,2);
        Agregar = new Command ("Agregar",Command.BACK,2);

  }

  public void startApp(){

    display = Display.getDisplay(this);
    form = new Form("Agenda");
       form.append(s);
    form.append(name);
    form.append(telefono);

    form.addCommand(ok);
     form.setCommandListener(this);
        form.addCommand(salir);
    form.setCommandListener(this);
    display.setCurrent(form);
  }

  public void pauseApp(){

  }

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


  public void showInput(){

       n = "Registro" +"nNombre:" + name.getString() + "nTelefono: " + telefono.getString();
       form = new Form("Agenda");
   
      form.addCommand(salir);
     form.setCommandListener(this);
     form.addCommand(borrar);
     form.setCommandListener(this);
     display.setCurrent(form);
      form.addCommand(agregar);
     form.setCommandListener(this);
     display = Display.getDisplay(this);
      form.append(n);

     //    s = ("Registro 1 "+""+"n Nombre: "+"Antonio"+"n Telefono:"+"555123456");
     //n = "Registro2n"+"Nombre:" + name.getString() + "nTelefono: " + telefono.getString();
//     s = "Registro3n"+"Nombre:" + name.getString() + "nTelefono: " + telefono.getString();
//    String c = "Telefono" + telefono.getString();
//       form.append(s);
//    form.append(c);

  }
  public void agregar() {
                         name = new TextField("Nombre:", "", 30, TextField.ANY);
    telefono = new TextField("Telefono:", "", 30, TextField.NUMERIC);
        form.append(name);
    form.append(telefono);
        form.addCommand(ok);
     form.setCommandListener(this);
        display.setCurrent(form);
  }


  public void commandAction(Command c, Displayable d) {
        int StringSelec = 0;
     if (c == ok) {
    String label = c.getLabel();
    if(label.equals("OK")){

      showInput();
        }
     }

      else   if (c ==salir) {
       destroyApp(true);
       notifyDestroyed();
        }
     else  if (c == borrar){

              display.setCurrent(form);
                form.delete(StringSelec);

            }
             else  if (c == agregar){
                agregar();
             }

        }
       
  }http://

2
C# / Re: Busqueda Secuencial
« en: Martes 16 de Febrero de 2010, 03:48 »
me pueden explicar un poco mas de for, es necesario el break,
si uso ese al estar buscando el elemento apesar de encontrarlo
no continua su busqeda hasta el final del arreglo
????

3
C# / Re: Busqueda Secuencial
« en: Lunes 15 de Febrero de 2010, 21:49 »
namespace Practica_1
{
    class Program
    {

        static void Main(string[] args);
//Con o sin el punto y coma despues de args me marca error

        int BuscaPosicion(int[] A, int x)
        {

            int posicion = -1;
            int i = 0;
            while ((posicion == -1) && (i < A.Length))
            {
                if (A == x)
                {

                    posicion = i;
                }
                else
                {

                    i++;
                }
            }
            return posicion;
        }



    }
}

4
C# / Re: Busqueda Secuencial
« en: Lunes 15 de Febrero de 2010, 18:55 »
ok, entonces a que se refiere este error :
en la parte de static void Main(string[] args)
me marca error porqe dice que tengo que declarar un
cuerpo ??

namespace Practica_1
{
    class Program
    {

        static void Main(string[] args);
        int BuscaPosicion(int[] A, int x)
        {

            int posicion = -1;
            int i = 0;
            while ((posicion == -1) && (i < A.Length))
            {
                if (A == x)
                {

                    posicion = i;
                }
                else
                {

                    i++;
                }
            }
            return posicion;
        }



    }
}

5
C# / Busqueda Secuencial
« en: Lunes 15 de Febrero de 2010, 17:30 »
Hola, necesito ayuda porfavor,
se trata de lo siguiente en C#
Leer desde el teclado un nùmero entero dado, usando la instruccion C int. Crear un arreglo
tipo entero de tamaño 10000. Reyenarel arreglo con numero aleatorios enteros entre el
0 y 9999 usando la instruccion  ran ().  Reportar la posicion del numero que estoy buscando en el arreglo.

No es necesario usar clases ni execciones, es mas sencillo.
Se los agradeceria mucho

Páginas: [1]