Prezados consultores,

eu tentei a sugestao indicada por voces, referente a
entrada de dados, e ocorreu o seguinte erro em tempo
de execucao:

> java.lang.NumberFormatException:
>      at java.lang.Integer.parseInt(+271)
>      at java.lang.Integer.parseInt(+6)
>      at calcular.commandAction(+164)
>      at
javax.microedition.lcdui.Display$DisplayAccessor.commandA
ction(+152)
>      at
com.sun.kvem.midp.lcdui.EmulEventHandler$EventLoop.run
(+459)

Segue parte do codigo:

Form cmd_calcular = new Form("Calcular");
       cmd_calcular.addCommand(Voltar);
       cmd_calcular.addCommand(Sair);
 // 1. cmd_calcular.append(new StringItem(null, "Entre
c/ inteiro n:"));
       TextField vin = new TextField("Entre c/ inteiro
n: ", "", 1, TextField.NUMERIC); // 2.
       cmd_calcular.setCommandListener(this);
 // 1. byte[] vbuf = {1,2,3,4,5};
 // 1. ByteArrayInputStream vin = new
ByteArrayInputStream(vbuf,1,1);
 // 1. int vint = vin.read();
       int vint = Integer.parseInt(vin.getString()); //
2.
       cmd_calcular.append(new StringItem(null, " " +
vint));
       cmd_calcular.append(new StringItem
(null, "\nResultado n * n = " + (vint * vint)));
       mDisplay.setCurrent(cmd_calcular);

O que esta marcado com 1. funciona, mas permite apenas
calculos pre-estabelecidos a partir do array, vbuf.  O
que esta com 2. eh referente a sugestao de voces.

Agradeco comentarios e sugestoes.

Sds,

Werner CJ Denzin.


__________________________________________________________________________
Encontre sempre uma linha desocupada com o Discador BOL!
http://sac.bol.com.br/discador.html
Ainda n�o tem AcessoBOL? Assine j�! http://sac.bol.com.br


Responder a