Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Android: Disable setPositiveButton unless and until items are selected

You can access the OK button from your AlertDialog using getButton(Dialog.BUTTON_POSITIVE). Modify the OnClickListener that launches the dialog so that you disable the OK button before you show the dialog:

OnClickListener() {
    public void onClick(View arg0) {
        AlertDialog dialog = ad.create();
        Button okButton =
        okButton.setEnabled(false);; // call show on the
AlertDialog, not the Builder

I'm not sure of exactly what needs to happen for you to enable the button, but if it is response to the user selecting a particular item, then you should but the enabling code inside your OnMultiChoiceClickListener:

ad.setMultiChoiceItems(myList,bl, new
OnMultiChoiceClickListener() {
    public void onClick(DialogInterface arg0, int
arg1, boolean arg2) {
        else if (selList.contains(arg1))
        if ( /* YOUR CODE HERE */ ) {
            AlertDialog dialog = (AlertDialog)
            Button okButton =

Categories : Android

Related to : Android: Disable setPositiveButton unless and until items are selected
Android usethe same alertdialog and set different setPositiveButton content
In your DialogUtils class write the below functions public static void showMessageDialog(Context context, String title, String message, final DialogClickListener dialogBtnClickListener, String positiveButtonText, String negativeButtonText) { AlertDialog.Builder alert = new AlertDialog.Builder(new ContextThemeWrapper(context,; alert.setIco

Categories : Android
oracle adf how to disable selected rows by click on bottun?
I'm assuming you want to disable selection of rows in a table. Your question is not very clear. Create a bean and an attribute inside it which will handle the table selection. This can have the values "single", "none" etc. Read more about it here: Drag and drop a button, double click it to create the code in the backi

Categories : Oracle
How to get clicked/selected items of a QTreeWidget
From the Qt documentation: QTreeWidget Class Reference , QTreeWidgetItem Class Reference selectedItems() is a function of QTreeWidget. QList QTreeWidget::selectedItems () const Returns a list of all selected non-hidden items. text() is a function of QTreeWidgetItem QString QTreeWidgetItem::text ( int column ) const Returns the text in the specified column. Define a list of Q

Categories : C++
Pivot WP 8.1 VisualStateManager for selected items doesn't work?
This is a known issue with customised Pivot Header in Windows Phone Runtime. The Silverlight 8.1 Pivot works correctly. I'm not aware of any workarounds that would give the control you are looking for. You can override the Pivot's theme colours app-wide in the app.xaml's resources. The presenter for the header is encapsulated in the PivotHeaderPanel and so their full appearance cannot be modified

Categories : Xaml
Post all selected items of multiselect list in JQuery Ajax
Since the variable myAlgorithm in the function is an array, I would recommend rewriting the following line; jQuery will take care of creating the necessary query string for the ajax call on the client-side. Change: data: "{"sen1":"" + sen1 + "","sen2":"" + sen2 + "","lang":"" + lang + "","myAlgorithm":"" + myAlgorithm + "","method":"" + method + "",}", To: data: { sen1: sen1, sen2:

Categories : Javascript
Recently Add
I'm trying to create an onListItemClick even for a customized adapter. The array of items is found in res/values folder
No navigation/status bar touch listener exists, why?
z-index in Relative layout
java.lang.SecurityException: Permission Denial: getIntentSender() when using UiAutomation in a test
mvvmcross videoview URL binding
Android Emulator Unfortunately dev tools has stopped
Square Dagger error: class is exclusively members injected / cannot be scoped required
Installing a widget from an APP
How to stop onDraw() methods causing jerky scrolling of a ListView
How to find my Google Play Services Android BASE64_PUBLIC_KEY
Set style programatically does not work
How to get contacts from phonebook and sim but skype, facebook etc. in android
Where to put JUnit test in Android project
My Android Studio project keeps running my old project/application
how to avoid OUtOfMemory problems with create Bitmap
What tools use and how do continuous integration and test in Android with eclipse?
Converting drawable resource to Bitmap Android
Fragment Transaction show() does not show fragment on second time
Espresso - How to match ActionBar visibility?
Viewport setting ignored in Phonegap Android app, but only on certain phones?
how to open an activity with url scheme android
Android AsyncTask and Thread different behavior
How can one ellicit a Toast from a Service to a Fragment
GCMIntentService onRegistered not called
LinearLayout cropping but not expanding in Scrollview
Get a file from the application directory
How to set layout params using view's on touch listener?
How to disable Google Fit and revoke permissions from the app itself
Android Wear - receiving message from Wear without WearableListenerService?
How can I start new activity from another package?
© Copyright 2017 Publishing Limited. All rights reserved.