How I can show soft keyboard on canvas and write on it in android
<p>I am trying to write on the canvas by the soft keyboard in android.</p>

<p>My question is how can I show soft keyboard and handle events it generate on the canvas.
My code is :</p>

<pre><code>public class DrawView extends View {
            Paint paint = new Paint();
            private static final String LOGID = "MxView";
            String message = "No key pressed yet.";
            DrawView(Context context) {
                    super(context);
                    setFocusable(true);
            }

            @Override
            protected void onDraw(Canvas canvas) {

                    canvas.drawText(message, 5, 20, paint);

            }
            @Override
            public boolean onKeyDown(int keyCode, KeyEvent ev) {
                    switch(keyCode) {
                    case KeyEvent.KEYCODE_ENTER:
                            message = "Key is Enter!";
                            Log.i(LOGID, message);
                            break;
                    case KeyEvent.KEYCODE_E:
                            message = "Key is E!";
                            Log.i(LOGID, message);
                            break;
                    default:
                            return false;
                    }
                    invalidate();
                    return true;
            }
        }
</code></pre>
