Skip to content

Commit cfa8c23

Browse files
committed
Custom prompt now shows the soft keyboard.
1 parent 2ca2a84 commit cfa8c23

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/src/main/java/info/microalg/android/DisplayResult.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.os.Bundle;
1111
import android.view.Menu;
1212
import android.view.MenuItem;
13+
import android.view.WindowManager;
1314
import android.webkit.JsPromptResult;
1415
import android.webkit.WebChromeClient;
1516
import android.webkit.WebSettings;
@@ -94,7 +95,7 @@ public boolean onJsPrompt(WebView view, String url, String message,
9495
final EditText et = new EditText(view.getContext());
9596
et.setSingleLine();
9697
et.setText(defaultValue);
97-
new AlertDialog.Builder(view.getContext())
98+
AlertDialog dialog = new AlertDialog.Builder(view.getContext())
9899
.setTitle(R.string.app_name)
99100
.setMessage(message)
100101
.setView(et)
@@ -110,7 +111,9 @@ public void onCancel(DialogInterface dialog) {
110111
result.cancel();
111112
}
112113
})
113-
.show();
114+
.create();
115+
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
116+
dialog.show();
114117
return true;
115118
}
116119
});

0 commit comments

Comments
 (0)