Improve Android alert/prompt behaviour?
See original GitHub issueLooks like using window.prompt
or window.alert
ends up with extremely ugly alerts. Example (local html):
Is it possible to improve this? Afer doing some research, seems like it can be improved by using the Chrome client, something like…
webView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
AlertDialog dialog = new AlertDialog.Builder(view.getContext()).
setTitle("YourAlertTitle").
setMessage(message).
setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//do nothing
}
}).create();
dialog.show();
result.confirm();
return true;
} });
Further looking at the code, this library is already using the chrome client, so perhaps it is straight forward to implement:
So it would be a matter of implementing:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Improve Android alert/prompt behaviour? · Issue #1385 - GitHub
Looks like using window.prompt or window.alert ends up with extremely ugly alerts. Example (local html): Is it possible to improve this?
Read more >Notifications Overview | Android Developers
A notification is a message that Android displays outside your app's UI to provide the user with reminders, communication from other people, or...
Read more >Behavior changes: Apps targeting Android 12
If your app targets Android 12, you must specify the mutability of each PendingIntent object that your app creates. This additional requirement improves...
Read more >Create a Notification - Android Developers
Notifications provide short, timely information about events in your app while it's not in use. This page teaches you how to create a...
Read more >Dialogs - Android Developers
Building an Alert Dialog ... The AlertDialog class allows you to build a variety of dialog designs and is often the only dialog...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wow, 2 months already, time flies! Can we re-open this? This is definitely still an issue. Alert/Prompts are all nicely implement on iOS, while they look terrible on Android!
I would like to report that it’s July 2021 and Alert.alert() on Android is still too ugly for any commercial application kthx