This is how I ended up solving it:

currentRankText.setText(Integer.toString(keyCode));

Is that a good solution or I am opening myself to trouble?

On May 30, 4:04 pm, Mauricio <[email protected]> wrote:
> What is the best way to print the int associated with each key I
> pressed? I tried something like this:
>
>     public boolean onKeyDown(int keyCode, KeyEvent event)
>     {
>         super.onKeyDown(keyCode, event);
>         switch (keyCode)
>         {
>         default :
>                 // Something might happen here
>                 TextView currentRankText =
>                         (TextView)  this.findViewById(R.id.TypedStuff);
>                 currentRankText.setText((char)keyCode);
>         break;
>         }
>         return true;
>
> and, well, all I managed to do was to crash the emulator.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to