How to use Android soft keyboard in SurfaceView

I have a SurfaceView that I draw, without controls, text boxes or any other types of form type items. I want to be able to:

1: Touch I drew a circle on the SurfaceView onDraw() method, and then opened the default android soft keyboard. (I know how to do the touch detection part, only need to open the soft keyboard in a certain way)

2: When When I type, I want the letters I selected to be displayed on the canvas (I know how to draw the part again, but how do I capture the key that the user selected first?)

A lot of tanks

David

You can try this to show the keyboard:

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

If it shows to you, then I miss you You can listen to key events by overriding the onKeyDown() method of your activity

I have a SurfaceView that I draw, no controls, text boxes or any other type of form Item. I want to be able to:

1: Touch a circle I drew on the SurfaceView onDraw() method, and then open the default android soft keyboard. (I know how to do the touch detection part, only The soft keyboard needs to be opened in some way)

2: When I type, I want the letters I selected to be displayed on the canvas (I know how to draw the part again, but how do I capture the key that the user selected first? )

Many tanks

David

You can try this to show the keyboard:

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodM anager.SHOW_FORCED,0);

If it is shown to you, then I think you can listen to key events by overriding the onKeyDown() method of your activity

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1538 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.