Get Enter Character \r\n or 13

hihow to get enter character from textfield. as in c language we user 13 as charactercode for enter. but what abt in j2me.
[136 byte] By [Hassan_GuGua] at [2007-11-27 4:15:59]
# 1
Why do you need to get carriage return?Anyway, the value would be the same, it's Unicode ( <128 == ASCII ) anyway. So you'd get 10 or 13. I think you should get 10 as the integer value of that particular character.But again why do you want the value?
nogoodatcodinga at 2007-7-12 9:22:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
bcoz i m developing chatting sw. in nokia 9300 communicator when user press enter key we have to send message. when i convert enter character in ASCII then it give A233 as character. is ti correct or not. thnx for replying
Hassan_GuGua at 2007-7-12 9:22:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

I tried it out on the Sun WTK and I get the value as 10 for the newline character that can be entered from the set of symbols ( usually the last one, an arrow with the shaft first down and then left )

I dunno about the Nokia 9300, but it should be following the same norms...

Can you give the code you used to convert the input character to get A223? Because that is something like a beta symbol according to what I could find on the net: http://www.ereader.com/dropbook/pml/characters.

nogoodatcodinga at 2007-7-12 9:22:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
sSendMsg is my message which i send let suppose = "hassan"after pressing Enter. it give me correct ASCII of all except enter. check it.char ch = sSendMsg.charAt(k);String str = String.valueOf(ch);int i = (int) ch;i is ASCII in integer format.
Hassan_GuGua at 2007-7-12 9:22:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

Hm, yeah that is what I've done too:

public class InputTestMidlet

extends MIDlet

implements CommandListener,

ItemStateListener

{

Display theDisplay = null;

Form frmInputCheck = null;

Alert altOutput = null;

TextField txtField = null;

Command cmdExit = null;

InputTestMidlet ()

{

theDisplay = Display.getDisplay(this);

frmInputCheck = new Form("Input Test");

altOutput = new Alert("Entered Character");

altOutput.setTimeout(Alert.FOREVER);

txtField = new TextField("Enter a character", "", 1, TextField.ANY);

cmdExit = new Command("Exit", Command.EXIT, 0);

//frmInputCheck.append(txtBox);

frmInputCheck.append(txtField);

frmInputCheck.addCommand(cmdExit);

frmInputCheck.setCommandListener(this);

frmInputCheck.setItemStateListener(this);

}

public void startApp()

{

theDisplay.setCurrent(frmInputCheck);

}

public void pauseApp()

{

}

public void destroyApp(boolean unconditional) {

}

public void commandAction(Command command, Displayable displayable)

{

System.out.println(command );

if ( command == cmdExit )

{

notifyDestroyed();

}

}

public void itemStateChanged(Item item)

{

if ( item == txtField )

{

String currentInput = txtField.getString();

txtField.setString("");

altOutput.setString("The character '" + currentInput + "' has the integer value " + Integer.toString((int)currentInput.charAt(0)));

theDisplay.setCurrent(altOutput, frmInputCheck);

}

}

}

You can try this out and see, though it's pretty much the same as yours. I haven't been able to try it out on my phone since my cable seems to be spoiled.

Maybe you should check out the Nokia developer forums or check out the documentation for the phone....

nogoodatcodinga at 2007-7-12 9:22:26 > top of Java-index,Java Mobility Forums,Java ME Technologies...