Example usage for android.app AlertDialog.Builder findViewById

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

Introduction

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

Prototype

@Nullable
public <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID or null if the ID is invalid (< 0), there is no matching view in the hierarchy, or the dialog has not yet been fully created (for example, via #show() or #create() ).

Usage

From source file:com.todoroo.astrid.taskrabbit.TaskRabbitActivity.java

public void showIntroDialog() {
    if (!Preferences.getBoolean(TASK_RABBIT_DIALOG_INTRO_PREF, false)) {
        if (TaskRabbitLocationManager.supportsCurrentLocation(currentLocation)) {

            AlertDialog.Builder adb = new AlertDialog.Builder(TaskRabbitActivity.this);
            adb.setTitle(R.string.tr_alert_intro_title);
            adb.setMessage(getString(R.string.tr_alert_intro_location));
            adb.setPositiveButton(getString(R.string.tr_alert_button_close),
                    new DialogInterface.OnClickListener() {
                        public void onClick(final DialogInterface dialog, final int id) {
                            showAddListPopover();
                        }/*from  w  w  w  . java2  s.  c om*/
                    });
            adb.show();
        } else {
            final AlertDialog adb = new AlertDialog.Builder(TaskRabbitActivity.this)
                    .setTitle(R.string.tr_alert_intro_title).setMessage(R.string.tr_alert_intro_no_location)
                    .setPositiveButton(getString(R.string.tr_alert_button_close), null).show();

            ((TextView) adb.findViewById(android.R.id.message))
                    .setMovementMethod(LinkMovementMethod.getInstance());
        }
        Preferences.setBoolean(TASK_RABBIT_DIALOG_INTRO_PREF, true);
    }
}