I have made a webbrowser application for android (minSdkVersion 21) It is working fine but I have a little problem with the Keyboard and a button.
Here you can see the app there is a button when I click on GO it loads a page. But when i click on enter in my keyboard it does nothing.
I have tried the following:
- KeyEvent.KEYCODE_ENTER
- loadUrl
In my activity_main.xml
<Button
android:id="@+id/button"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:imeOptions="actionGo"
android:layout_centerVertical="true"
android:text="Go"/>
I think there is no problem so far with my activity_main.xml
And in my MainActivity.java
i have:
Button button;
button = (Button) findViewById(R.id.button);
button.setImeActionLabel("", KeyEvent.KEYCODE_ENTER);
webView.loadUrl("");
return true;
When i click on enter on my keyboard i want to have the same function as my button "GO" (it needs to load a page)