Android DialogInterface - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android DialogInterface class.

This code example shows how to use the following methods:dismiss
        return dialog;
    } 
 
    @Override 
    public void onClick(DialogInterface dialog, int which) {
        dialog.dismiss();
        switch (which) {
        case BUTTON_POSITIVE:
            onResult(RESULT_OK);
            break; 
        case BUTTON_NEGATIVE:
            onResult(RESULT_CANCELED);
            break; 
        } 
    } 
} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:dismiss
        return dialog;
    } 
 
    @Override 
    public void onClick(DialogInterface dialog, int which) {
        dialog.dismiss();
    } 
} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:cancel
                public void onClick(DialogInterface dialog, int index) { 
                    if (index >= 0 && index < mAccounts.length) { 
                        mAccount = mAccounts[index]; 
                        startAuthentication(); 
                    } 
                    dialog.cancel(); 
                } 
            }; 
 
    public IITC_DeviceAccountLogin(IITC_Mobile activity, WebView webView,
                                   WebViewClient webViewClient) {
        mActivity = activity;
        mWebView = webView;
        mAccountManager = AccountManager.get(activity);
        mAccountAdapter = new AccountAdapter();
 
        // dialog that serves as a progress bar overlay 
        mProgressbar = new AlertDialog.Builder(mActivity)
                .setCancelable(false)
                .setView(mActivity.getLayoutInflater().inflate(R.layout.dialog_progressbar, null))
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:dismiss
                    View decor = win.getDecorView();
                    if (decor != null) {
                        KeyEvent.DispatcherState ds = decor.getKeyDispatcherState();
                        if (ds != null && ds.isTracking(event)) {
                            mMenu.close(true);
                            dialog.dismiss();
                            return true; 
                        } 
                    } 
                } 
            } 
        } 
 
        // Menu shortcut matching 
        return mMenu.performShortcut(keyCode, event, 0);
 
    } 
 
    public void setPresenterCallback(MenuPresenter.Callback cb) { 
        mPresenterCallback = cb; 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:dismiss
            builder.setSingleChoiceItems(items, -1,
                    new DialogInterface.OnClickListener(){
                public void onClick(DialogInterface dialog, int which) {
                    switch (which) {
                        case OPEN_DIRECTORY:
                            dialog.dismiss();
                            mPath = path;
                            mFocusFile = null;
                            updateList(); 
                            break; 
                        case RUN_TESTS:
                            dialog.dismiss();
                            processDirectory(path, false);
                            break; 
                    } 
                } 
            }); 
            builder.create().show();
        } else { 
            processFile(path, false);
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:cancel
                .setPositiveButton( 
                        context.getResources().getString(
                                R.string.ok),
                        new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    } 
                }); 
        return  builder.create();   
    } 
     
    /** 
     * @return  HTML displaying the changes since the previous 
     *          installed version of your app (what's new) 
     */ 
    public String getLog() {
        return  this.getLog(false);
    } 
 
    /** 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:dismiss
                }); 
        builder.setNegativeButton(android.R.string.cancel,
                new DialogInterface.OnClickListener() {
                    @Override 
                    public void onClick(DialogInterface dialog, int whichButton) {
                        dialog.dismiss();
                    } 
                }); 
        return builder.create();
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:cancel
     */ 
    @Override 
    public void onClick(DialogInterface dialog, int which) {
        switch (which) {
            case DialogInterface.BUTTON_NEGATIVE:
                dialog.cancel();
                break; 
            case DialogInterface.BUTTON_POSITIVE:
                final long accountId = getArguments().getLong("accountId");
                final String text = mQuickResponseEditText.getText().toString();
                final Context context = getActivity();
                if (mQuickResponse == null) {
                    mQuickResponse = new QuickResponse(accountId, text);
                } 
 
                // Insert the new QuickResponse into the database. Content watchers used to 
                // update the ListView of QuickResponses upon insertion. 
                EmailAsyncTask.runAsyncParallel(new Runnable() {
                    @Override 
                    public void run() { 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:dismiss
		this.setTitle( title );
		this.setMessage( message );
		this.setCancelable( false );
		this.setButton( "Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
            	dialog.dismiss();
            } 
        });			 
	} 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:cancel, dismiss

Related Android DialogInterface Questions & Answers:

Other Android DialogInterface Examples

26:	private final class CancelOnClickListener implements
27:	    DialogInterface.OnClickListener {
28:	  public void onClick(DialogInterface dialog, int which) {
29:	    Toast.makeText(getApplicationContext(), "Cancle selected, activity continues",
30:	        Toast.LENGTH_LONG).show();
-
34:	private final class OkOnClickListener implements
35:	    DialogInterface.OnClickListener {
36:	  public void onClick(DialogInterface dialog, int which) {
37:	    AlertExampleActivity.this.finish();
38:	  }

Read More

11:					// Setting Positive "Yes" Button
12:					alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
13:						public void onClick(DialogInterface dialog, int which) {
14:						// User pressed YES button. Write Logic Here
15:						Toast.makeText(getApplicationContext(), "You clicked on YES",
-
20:					// Setting Negative "NO" Button
21:					alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
22:						public void onClick(DialogInterface dialog, int which) {
23:						// User pressed No button. Write Logic Here
24:						Toast.makeText(getApplicationContext(), "You clicked on NO", Toast.LENGTH_SHORT).show();
-
28:					// Setting Netural "Cancel" Button
29:					alertDialog.setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
30:						public void onClick(DialogInterface dialog, int which) {
31:						// User pressed Cancel button. Write Logic Here
32:						Toast.makeText(getApplicationContext(), "You clicked on Cancel",

Read More

11:			// Setting Positive "Yes" Button
12:			alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
13:				public void onClick(DialogInterface dialog,int which) {
14:	
15:				// Write your code here to invoke YES event
-
20:			// Setting Negative "NO" Button
21:			alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
22:				public void onClick(DialogInterface dialog,	int which) {
23:				// Write your code here to invoke NO event
24:				Toast.makeText(getApplicationContext(), "You clicked on NO", Toast.LENGTH_SHORT).show();

Read More

12:			// Setting OK Button
13:			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
14:					public void onClick(DialogInterface dialog, int which) {
15:					// Write your code here to execute after dialog closed
16:					Toast.makeText(getApplicationContext(), "You clicked on OK", Toast.LENGTH_SHORT).show();

Read More

See Code Examples for Android DialogInterface Methods: