How to show a keyboard for writing on my view?
<p>There is some problem: I have my custom view for drawing by finger, and now I need to do following thing: when user click by view double times the application should to draw on the view text using keyboard. I unserstand that it's simple to show keyboard for EditText, for example, but can I do it for custom view? For example, user click by view, keyboard are showed, and he can type any text. Which methods should I override?</p>

<pre><code>public class PainterView extends View implements DrawingListener {

    private GestureDetector detector;
    private Context context;
    private Painter painter;
    private Bitmap bitmap;
    private Paint bitmapPaint;
    private Path path;
    private Paint paint;

    private float x;
    private float y;

    public PainterView(Context context, Painter painter) {

        super(context);
        this.context = context;
        this.painter = painter;
        detector = new GestureDetector(context, new GestureListener());

    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        if (bitmap != null) {
            canvas.drawBitmap(bitmap, 0, 0, bitmapPaint);
            canvas.drawPath(path, paint);
        }
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        detector.onTouchEvent(event);
        x = event.getX();
        y = event.getY();
        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            painter.touchStart(x, y);
            break;
        case MotionEvent.ACTION_MOVE:
            painter.touchMove(x, y);
            break;
        case MotionEvent.ACTION_UP:
            painter.touchUp();
            break;
        }
        return true;
    }

    @Override
    public void onPictureUpdate(Bitmap bitmap, Paint bitmapPaint, Path path,
            Paint paint) {
        this.bitmap = bitmap;
        this.bitmapPaint = bitmapPaint;
        this.path = path;
        this.paint = paint;
        invalidate();
    }

    public void setPainter(Painter painter) {
        this.painter = painter;
    }

    private class GestureListener extends GestureDetector.SimpleOnGestureListener {

        @Override
        public boolean onDoubleTap(MotionEvent e) {
            float x = e.getX();
            float y = e.getY();
            InputMethodManager mgr = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
            // only will trigger it if no physical keyboard is open
            mgr.showSoftInput(PainterView.this, 0);
            //painter.drawString(x, y, "123");
            return true;
        }
    }
}
</code></pre>

<p>Now this code doesn't work.   </p>
