Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing user input in an integer variable

 
Hari Das
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !

i m new to J2ME. I am making a calculator program. Can anybody tel me how to accept an integer from the user in a mobile.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually it is really simple. Using a TextField, you can have it only accept numbers, using the constant NUMERIC in the constructor, the last parameter. the getString method will return the valueas a string and use the common methods of Integer class to get the int value back.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic