1

I am using a WebView but it does not show the keyboard when clicking on a text field. I tried the solution from this question.Now it works fine in portrait mode, but there is still no keyboard in landscape mode.

My code:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        setContentView(R.layout.reservation);
        String url = "https://www.somewebsite.com";


        reservationView = (WebView) findViewById(R.id.reservationView);
        reservationView.loadUrl(url);
        reservationView.getSettings().setJavaScriptEnabled(true);
        //prevents opening the browser
        reservationView.setWebViewClient(new InsideWebViewClient());

        reservationView.setOnTouchListener(new View.OnTouchListener()
        {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction())
                {
                    case MotionEvent.ACTION_DOWN:
                    case MotionEvent.ACTION_UP:
                        if (!v.hasFocus())
                        {
                            v.requestFocus();
                        }
                        break;
                }
                return false;
            }
        });}

Does anybody know a solution?

edit: Just discoverd that it works fine in the emulator with Android 4.1, but not with 2.3. Maybe a bug in the emulator?

Community
  • 1
  • 1
Apfelsaft
  • 5,766
  • 4
  • 28
  • 37

0 Answers0