Arjun Sunil Kumar
Arjun Sunil Kumar

Reputation: 1838

Keycode for '^' (caret) in android java?

I am developing a Simple calculator for android platform. I am using my own custom keyboard layout. To set a KeyPressed Event, I use the following code:

tv1.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_0));

After googling all the android resources like:

http://developer.android.com/reference/android/view/KeyEvent.html

I couldn't find the KeyCode for caret symbol. Is there any keycode for that symbol?

Upvotes: 1

Views: 796

Answers (1)

Tyler
Tyler

Reputation: 19858

editText.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            Log.d("KeyCode", "" + keyCode);
        }
    });

Attach that to an edit text.

Then, just go to logcat and see which keyCode comes up when you hit ^

Upvotes: 1

Related Questions