Example usage for android.app AlertDialog.Builder create

List of usage examples for android.app AlertDialog.Builder create

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder create.

Prototype

public void create() 

Source Link

Document

Forces immediate creation of the dialog.

Usage

From source file:edu.missouri.niaaa.ema.activity.AdminManageActivity.java

private Dialog removeDialog(Context context) {

    LayoutInflater inflater = LayoutInflater.from(context);
    final View textEntryView = inflater.inflate(R.layout.remove_id, null);
    final CheckBox rm_check = (CheckBox) textEntryView.findViewById(R.id.rm_local);
    rm_check.setText(R.string.remove_local);
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setView(textEntryView);//from   ww w  .  j  a  v a 2s .  c o  m
    builder.setCancelable(false);
    builder.setTitle(R.string.assign_remove_title);
    builder.setMessage(R.string.remove_msg);
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub  

            cleanUp(ctx);//replace following

            //                    editor.putString(Utilities.SP_KEY_LOGIN_USERID, "");                       
            //                 editor.putString(Utilities.SP_KEY_LOGIN_USERPWD, "");
            //                 editor.putString(Utilities.SP_KEY_LOGIN_STUDY_STARTTIME, "");
            //                 editor.commit();

            // remove local file, if checked
            Log.d(TAG, "is checked " + rm_check.isChecked());
            if (rm_check.isChecked()) {
                deleteDirectory(Utilities.PHONE_BASE_PATH);
            }

            setHints();
            finish();
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub  

        }
    });

    return builder.create();

}

From source file:eu.operando.operandoapp.filters.domain.DomainFiltersActivity.java

@OnClick(R.id.add_filter)
public void addFilter() {

    if (viewSelected == 0) { //User Filter

        View dialogView = getLayoutInflater().inflate(R.layout.user_domain_filter_dialog, null);
        final EditText input = (EditText) dialogView.findViewById(R.id.filter_content);
        final CheckBox isWildcard = (CheckBox) dialogView.findViewById(R.id.is_wildcard);

        AlertDialog.Builder builder = new AlertDialog.Builder(this).setTitle("New DomainFilter")
                .setView(dialogView)//  w ww  .jav  a  2s.c o  m
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {

                        DomainFilter domainFilter = new DomainFilter();
                        domainFilter.setContent(input.getText().toString().toLowerCase());
                        domainFilter.setSource(null);
                        domainFilter.setIsWildcard(isWildcard.isChecked());
                        db.createDomainFilter(domainFilter);
                        updateFiltersList();
                        userDomainFiltersAdapter.notifyItemInserted(userFilters.size() - 1);
                        recyclerView.scrollToPosition(userFilters.size() - 1);
                    }
                }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        // Canceled.
                    }
                });

        final AlertDialog dialog = builder.create();

        input.addTextChangedListener(new TextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                if (Patterns.DOMAIN_NAME.matcher(s).matches()) {
                    dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
                } else
                    dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }
        });

        dialog.setOnShowListener(new DialogInterface.OnShowListener() {
            @Override
            public void onShow(DialogInterface dialog) {
                ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
            }
        });

        dialog.show();

    } else { //Imported filter list
        final EditText input = new EditText(this);
        input.setSingleLine(true);
        //input.setHint("Enter URL");
        input.setText(DatabaseHelper.serverUrl + "/blocked_urls");
        new AlertDialog.Builder(this).setTitle("Import filters from remote file (hosts file format)")
                .setView(input).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {

                        final String importUrl = input.getText().toString();
                        long start = System.currentTimeMillis();
                        importExternalFilters(importUrl);
                        long end = System.currentTimeMillis();
                        Toast.makeText(DomainFiltersActivity.this, (end - start) + "ms required",
                                Toast.LENGTH_LONG).show();

                    }
                }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        // Canceled.
                    }
                }).show();
    }
}

From source file:com.justone.android.main.MainActivity.java

/***
   * //from w  ww.  ja  v  a 2  s.c om
* @throws JSONException 
   */
public void checkVersion() throws JSONException {

    if (!Utils.isWifi(this))
        return;

    String versionInfo = this.dataOp.getUpdateVersionInfo();
    JSONObject jsonOb = new JSONObject(versionInfo);
    String viewData = jsonOb.getString("data");
    JSONArray jsonArray = new JSONArray(viewData);
    for (int i = 0; i < jsonArray.length(); i++) {
        JSONArray tempJson = (JSONArray) jsonArray.opt(i);

        if (tempJson.optString(0).equals("version_id")) {
            JustOne.setServerVersion(tempJson.optInt(1));
        }
        if (tempJson.optString(0).equals("version_name"))
            JustOne.versionName = tempJson.optString(1);
        if (tempJson.optString(0).equals("version_desc"))
            JustOne.setVersionDesc(tempJson.optString(1));
        if (tempJson.optString(0).equals("download_href"))
            JustOne.download_href = tempJson.optString(1);
        /*ArrayList<String> tempArray = new ArrayList<String>();
                
        tempJson.getJSONArray(index)
        tempArray.add(String.valueOf(nameToIdMap(tempJson
          .getString(0))));
        tempArray.add(String.valueOf(tempJson.getString(1)));
        tempArray.add(String.valueOf(tempJson.getString(2)));
        tempResult.add(tempArray);*/
    }
    if (JustOne.getLocalVersion() < JustOne.getServerVersion()) {
        // 
        AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle("").setMessage(JustOne.getVersionDesc())
                .setPositiveButton("", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Intent updateIntent = new Intent(MainActivity.this, UpdateService.class);
                        updateIntent.putExtra("app_name", getResources().getString(R.string.app_name));
                        startService(updateIntent);
                        dialog.dismiss();
                    }
                }).setNegativeButton("", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });
        alert.create().show();

    }
}

From source file:com.citrus.sdk.CitrusActivity.java

@Override
public void onBackPressed() {

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    // Add the buttons
    builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.dismiss();//from   ww  w  .  ja v a 2s.  c o  m
            isBackKeyPressedByUser = true;

            // If the PaymentType is CitrusCash or network is not available, finish the activity and mark the status as cancelled.
            // else load the url again so that Citrus can cancel the transaction and return the control to app normal way.
            if (mPaymentType instanceof PaymentType.CitrusCash || !Utils.isNetworkConnected(mContext)) {
                TransactionResponse transactionResponse = new TransactionResponse(
                        TransactionResponse.TransactionStatus.CANCELLED, "Cancelled By User", mTransactionId);
                sendResult(transactionResponse);
            } else {
                mPaymentWebview.loadUrl(mpiServletUrl);
            }
        }
    });
    builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {

        }
    });
    // Set other dialog properties
    builder.setMessage("Do you want to cancel the transaction?").setTitle("Cancel Transaction?");
    // Create the AlertDialog
    AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
}

From source file:ael.com.loterias.c_login.java

public void PRC_INTENTAR_SALIR() {

    // 1. Instantiate an AlertDialog.Builder with its constructor
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    // 2. Chain together various setter methods to set the dialog
    // characteristics
    builder.setMessage(R.string.st_la_pregunta_salir).setTitle(R.string.st_la_Exit);

    builder.setPositiveButton(R.string.st_la_Yes, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // User clicked OK button
            // Salimos de la herramienta
            c_logging.getInstance().log(c_logging.LOG_INFO, getString(R.string.st_la_Exit) + "OK");

            // Si el check est pinchado recordar en las preferences
            PRC_RECORDAR_MAIL_PASSWORD();

            finish();//from   www  .  j av a2 s.c o  m
        }
    });

    builder.setNegativeButton(R.string.st_la_No, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // User cancelled the dialog
            // No hacemos nada
            c_logging.getInstance().log(c_logging.LOG_INFO, getString(R.string.st_la_Exit) + "FAIL");
        }
    });

    // 3. Get the AlertDialog from create()
    AlertDialog dialog = builder.create();

    // Mostramos el cuadro de dialogo
    dialog.show();
}

From source file:org.ohthehumanity.carrie.CarrieActivity.java

/** Called when the activity is first created. */
@Override//  w w w.  ja va 2 s . c o m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mServerName = "";
    setContentView(R.layout.main);

    // instantiate our preferences backend
    mPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    // set callback function when settings change
    mPreferences.registerOnSharedPreferenceChangeListener(this);

    if (mPreferences.getString("server", null) == null) {
        setStatus("Server not set");
    } else if (mPreferences.getString("port", null) == null) {
        setStatus("Port not configured");
    }

    ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    if (cm.getActiveNetworkInfo().getType() != ConnectivityManager.TYPE_WIFI) {

        AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
        dlgAlert.setTitle("WiFi not active");
        dlgAlert.setMessage(
                "This application is usually used on a local network over a WiFi. Open WiFi settings?");
        dlgAlert.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                switch (which) {
                case DialogInterface.BUTTON_POSITIVE:
                    //Yes button clicked
                    final Intent intent = new Intent(Intent.ACTION_MAIN, null);
                    intent.addCategory(Intent.CATEGORY_LAUNCHER);
                    final ComponentName cn = new ComponentName("com.android.settings",
                            "com.android.settings.wifi.WifiSettings");
                    intent.setComponent(cn);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(intent);
                    break;

                case DialogInterface.BUTTON_NEGATIVE:
                    //Log.i(TAG, "Not opening wifi");
                    //No button clicked
                    break;
                }
            }
        });

        dlgAlert.setNegativeButton("No", null);
        dlgAlert.setCancelable(true);
        dlgAlert.create().show();
    }

    updateTitle();
    updateSkipLabels();
    updateServerName();
}

From source file:com.raceyourself.android.samsung.ProviderService.java

private void popupBluetoothDialog() {
    final AlertDialog.Builder builder = new AlertDialog.Builder(this);

    builder.setMessage("Your bluetooth is not enabled.\n\nPlease enable, connect to Gear and press retry.")
            .setCancelable(false).setPositiveButton("Retry", new DialogInterface.OnClickListener() {

                @Override/*from w w w.  ja v a 2 s  .co m*/
                public void onClick(DialogInterface dialog, int which) {
                    //Intent bluetooth = new Intent(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);
                    //bluetooth.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    //startActivity(bluetooth);

                    // continue with init
                    runUserInit();
                }
            }).setNegativeButton("Quit", new DialogInterface.OnClickListener() {

                @Override
                public void onClick(final DialogInterface dialog, @SuppressWarnings("unused") final int id) {
                    // TODO Auto-generated method stub
                    dialog.cancel();
                }
            }).setTitle("RaceYourself Gear Edition");

    alert = builder.create();
    alert.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
    alert.show();
}

From source file:com.dwdesign.tweetings.activity.ComposeActivity.java

protected void send() {
    final String text_orig = mEditText != null ? parseString(mEditText.getText()) : null;
    final String atext = mIsPhotoAttached || mIsImageAttached
            ? mUploadUseExtension ? getImageUploadStatus(this, FAKE_IMAGE_LINK, text_orig)
                    : text_orig + " " + FAKE_IMAGE_LINK
            : text_orig;/*  ww  w.  j a  v a2 s  . co  m*/
    final int count = mValidator.getTweetLength(atext);
    if (!isNullOrEmpty(mUploadProvider) && (mIsPhotoAttached || mIsImageAttached)) {
        postMedia();
    } else if (count > 140) {
        if (mScheduleDate != null) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(getString(R.string.schedule_tweet));
            builder.setMessage(getString(R.string.schedule_tweet_too_long));
            builder.setCancelable(true);
            AlertDialog alert = builder.create();
            alert.show();
        } else {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(getString(R.string.tweet_too_long));
            builder.setMessage(getString(R.string.confirm_twitlonger));
            builder.setCancelable(true);
            builder.setPositiveButton(getString(R.string.send_to_twitlonger),
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int id) {
                            postTwitlonger();
                        }
                    });
            builder.setNeutralButton(getString(R.string.split_tweets), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    splitTweets();
                }
            });
            builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    //actuallyPost();
                }
            });
            //
            AlertDialog alert = builder.create();
            alert.show();
        }

    } else {
        if (mScheduleDate != null && isNullOrEmpty(mUploadProvider) && (mIsPhotoAttached || mIsImageAttached)) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(getString(R.string.schedule_tweet));
            builder.setMessage(getString(R.string.schedule_tweet_pic_twitter));
            builder.setCancelable(true);
            AlertDialog alert = builder.create();
            alert.show();
        } else if (mScheduleDate != null && mIsBuffer == true) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(getString(R.string.schedule_tweet));
            builder.setMessage(getString(R.string.schedule_tweet_buffer));
            builder.setCancelable(true);
            AlertDialog alert = builder.create();
            alert.show();
        } else if (mIsBuffer == true && isNullOrEmpty(mUploadProvider)
                && (mIsPhotoAttached || mIsImageAttached)) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle(getString(R.string.add_to_buffer));
            builder.setMessage(getString(R.string.buffer_pic_twitter));
            builder.setCancelable(true);
            AlertDialog alert = builder.create();
            alert.show();
        } else {
            actuallyPost();
        }
    }
}

From source file:de.quadrillenschule.azocamsynca.job.JobProcessor.java

public void doTestShots(final TriggerPhotoSerie job) {
    final NikonIR camera = ((AzoTriggerServiceApplication) getActivity().getApplication()).getCamera();
    final JobProcessor jobProcessor = ((AzoTriggerServiceApplication) getActivity().getApplication())
            .getJobProcessor();//from w  w w  . j  a va  2 s. c o m

    final AlertDialog.Builder adb = new AlertDialog.Builder(getActivity(), R.style.dialog);
    job.setTriggerStatus(PhotoSerie.TriggerJobStatus.WAITFORUSER);
    adb.setTitle("Test Shots");
    adb.setMessage("This series collects all images during preparation of the project\n" + job.getProject()
            + "\n" + "Camera controls time: " + camera.isExposureSetOnCamera(job.getExposure()));
    if (!job.isToggleIsOpen()) {
        adb.setPositiveButton("Finish", new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {
                job.setTriggerStatus(PhotoSerie.TriggerJobStatus.FINISHED_TRIGGERING);
                jobProcessor.fireJobProgressEvent(job);
                processingLoop();
            }
        });
    }

    adb.setNegativeButton("Trigger", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            camera.trigger();
            if (!camera.isExposureSetOnCamera(job.getExposure())) {
                job.setToggleIsOpen(!job.isToggleIsOpen());

                if (!job.isToggleIsOpen()) {
                    job.setNumber(job.getNumber() + 1);
                    job.setTriggered(job.getTriggered() + 1);

                }

            } else {
                job.setNumber(job.getNumber() + 1);
                job.setTriggered(job.getTriggered() + 1);
            }
            doTestShots(job);
        }
    });
    MediaPlayer mediaPlayer = MediaPlayer.create(activity, R.raw.oida_peda);
    mediaPlayer.start();
    // adb.create().show();
    adb.create();

    alertDialog = adb.show();
}

From source file:com.aware.ui.Plugins_Manager.java

private void drawUI() {
    //Clear previous states
    store_grid.removeAllViews();/*from  w w w .  j a  v  a  2s . c  o  m*/

    //Build UI
    Cursor installed_plugins = getContentResolver().query(Aware_Plugins.CONTENT_URI, null, null, null,
            Aware_Plugins.PLUGIN_NAME + " ASC");
    if (installed_plugins != null && installed_plugins.moveToFirst()) {
        do {
            final String package_name = installed_plugins
                    .getString(installed_plugins.getColumnIndex(Aware_Plugins.PLUGIN_PACKAGE_NAME));
            final String name = installed_plugins
                    .getString(installed_plugins.getColumnIndex(Aware_Plugins.PLUGIN_NAME));
            final String description = installed_plugins
                    .getString(installed_plugins.getColumnIndex(Aware_Plugins.PLUGIN_DESCRIPTION));
            final String developer = installed_plugins
                    .getString(installed_plugins.getColumnIndex(Aware_Plugins.PLUGIN_AUTHOR));
            final String version = installed_plugins
                    .getString(installed_plugins.getColumnIndex(Aware_Plugins.PLUGIN_VERSION));
            final int status = installed_plugins
                    .getInt(installed_plugins.getColumnIndex(Aware_Plugins.PLUGIN_STATUS));

            final View pkg_view = inflater.inflate(R.layout.plugins_store_pkg_list_item, null, false);
            pkg_view.setTag(package_name); //each view has the package name as a tag for easier references

            try {
                ImageView pkg_icon = (ImageView) pkg_view.findViewById(R.id.pkg_icon);
                if (status != PLUGIN_NOT_INSTALLED) {
                    ApplicationInfo appInfo = getPackageManager().getApplicationInfo(package_name,
                            PackageManager.GET_META_DATA);
                    pkg_icon.setImageDrawable(appInfo.loadIcon(getPackageManager()));
                } else {
                    byte[] img = installed_plugins
                            .getBlob(installed_plugins.getColumnIndex(Aware_Plugins.PLUGIN_ICON));
                    if (img != null)
                        pkg_icon.setImageBitmap(BitmapFactory.decodeByteArray(img, 0, img.length));
                }

                TextView pkg_title = (TextView) pkg_view.findViewById(R.id.pkg_title);
                pkg_title.setText(installed_plugins
                        .getString(installed_plugins.getColumnIndex(Aware_Plugins.PLUGIN_NAME)));

                ImageView pkg_state = (ImageView) pkg_view.findViewById(R.id.pkg_state);

                switch (status) {
                case PLUGIN_DISABLED:
                    pkg_state.setVisibility(View.INVISIBLE);
                    pkg_view.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            AlertDialog.Builder builder = getPluginInfoDialog(name, version, description,
                                    developer);
                            if (isClassAvailable(package_name, "Settings")) {
                                builder.setNegativeButton("Settings", new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        dialog.dismiss();
                                        Intent open_settings = new Intent();
                                        open_settings.setClassName(package_name, package_name + ".Settings");
                                        startActivity(open_settings);
                                    }
                                });
                            }
                            builder.setPositiveButton("Activate", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    Aware.startPlugin(getApplicationContext(), package_name);
                                    drawUI();
                                }
                            });
                            builder.create().show();
                        }
                    });
                    break;
                case PLUGIN_ACTIVE:
                    pkg_state.setImageResource(R.drawable.ic_pkg_active);
                    pkg_view.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            AlertDialog.Builder builder = getPluginInfoDialog(name, version, description,
                                    developer);
                            if (isClassAvailable(package_name, "Settings")) {
                                builder.setNegativeButton("Settings", new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        dialog.dismiss();
                                        Intent open_settings = new Intent();
                                        open_settings.setClassName(package_name, package_name + ".Settings");
                                        startActivity(open_settings);
                                    }
                                });
                            }
                            builder.setPositiveButton("Deactivate", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    Aware.stopPlugin(getApplicationContext(), package_name);
                                    drawUI();
                                }
                            });
                            builder.create().show();
                        }
                    });
                    break;
                case PLUGIN_UPDATED:
                    pkg_state.setImageResource(R.drawable.ic_pkg_updated);
                    pkg_view.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            AlertDialog.Builder builder = getPluginInfoDialog(name, version, description,
                                    developer);
                            if (isClassAvailable(package_name, "Settings")) {
                                builder.setNegativeButton("Settings", new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        dialog.dismiss();
                                        Intent open_settings = new Intent();
                                        open_settings.setClassName(package_name, package_name + ".Settings");
                                        startActivity(open_settings);
                                    }
                                });
                            }
                            builder.setNeutralButton("Deactivate", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    Aware.stopPlugin(getApplicationContext(), package_name);
                                    drawUI();
                                }
                            });
                            builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    Aware.downloadPlugin(getApplicationContext(), package_name, true);
                                }
                            });
                            builder.create().show();
                        }
                    });
                    break;
                case PLUGIN_NOT_INSTALLED:
                    pkg_state.setImageResource(R.drawable.ic_pkg_download);
                    pkg_view.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            AlertDialog.Builder builder = getPluginInfoDialog(name, version, description,
                                    developer);
                            builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                }
                            });
                            builder.setPositiveButton("Install", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    Aware.downloadPlugin(getApplicationContext(), package_name, false);
                                }
                            });
                            builder.create().show();
                        }
                    });
                    break;
                }
                store_grid.addView(pkg_view);
            } catch (NameNotFoundException e) {
                e.printStackTrace();
            }
        } while (installed_plugins.moveToNext());
    }
    if (installed_plugins != null && !installed_plugins.isClosed())
        installed_plugins.close();
}