How to change theme for AlertDialog

In Dialog.java (Android src) a ContextThemeWrapper is used. So you could copy the idea and do something like: AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom)); And then style it like you want: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <style name=”AlertDialogCustom” parent=”@android:style/Theme.Dialog”> <item name=”android:textColor”>#00FF00</item> <item name=”android:typeface”>monospace</item> <item name=”android:textSize”>10sp</item> </style> </resources>

Android: How to create a Dialog without a title?

FEATURE_NO_TITLE works when creating a dialog from scratch, as in: Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); But it doesn’t work when creating an AlertDialog (or using the Builder), because it already disables the title and use a custom one internally. I have looked at the SDK sources, and I think that it can’t be worked … Read more

Open directory dialog

You can use the built-in FolderBrowserDialog class for this. Don’t mind that it’s in the System.Windows.Forms namespace. using (var dialog = new System.Windows.Forms.FolderBrowserDialog()) { System.Windows.Forms.DialogResult result = dialog.ShowDialog(); } If you want the window to be modal over some WPF window, see the question How to use a FolderBrowserDialog from a WPF application. EDIT: If … Read more

Create and save a file with JavaScript [duplicate]

A very minor improvement of the code by Awesomeness01 (no need for anchor tag) with addition as suggested by trueimage (support for IE): // Function to download data to a file function download(data, filename, type) { var file = new Blob([data], {type: type}); if (window.navigator.msSaveOrOpenBlob) // IE10+ window.navigator.msSaveOrOpenBlob(file, filename); else { // Others var a … Read more

How to make an alert dialog fill 90% of screen size?

According to Android platform developer Dianne Hackborn in this discussion group post, Dialogs set their Window’s top level layout width and height to WRAP_CONTENT. To make the Dialog bigger, you can set those parameters to MATCH_PARENT. Demo code: AlertDialog.Builder adb = new AlertDialog.Builder(this); Dialog d = adb.setView(new View(this)).create(); // (That new View is just there … Read more

How do I use OpenFileDialog to select a folder?

Basically you need the FolderBrowserDialog class: Prompts the user to select a folder. This class cannot be inherited. Example: using(var fbd = new FolderBrowserDialog()) { DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { string[] files = Directory.GetFiles(fbd.SelectedPath); System.Windows.Forms.MessageBox.Show(“Files found: ” + files.Length.ToString(), “Message”); } } If you work in WPF you have … Read more

How to prevent a dialog from closing when a button is clicked

EDIT: This only works on API 8+ as noted by some of the comments. This is a late answer, but you can add an onShowListener to the AlertDialog where you can then override the onClickListener of the button. final AlertDialog dialog = new AlertDialog.Builder(context) .setView(v) .setTitle(R.string.my_title) .setPositiveButton(android.R.string.ok, null) //Set to null. We override the onclick … Read more

How to create a dialog with “Ok” and “Cancel” options

You’re probably looking for confirm(), which displays a prompt and returns true or false based on what the user decided: if (confirm(‘Are you sure you want to save this thing into the database?’)) { // Save it! console.log(‘Thing was saved to the database.’); } else { // Do nothing! console.log(‘Thing was not saved to the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)