Example usage for android.app AlertDialog.Builder setCancelable

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

Introduction

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

Prototype

public void setCancelable(boolean flag) 

Source Link

Document

Sets whether this dialog is cancelable with the KeyEvent#KEYCODE_BACK BACK key.

Usage

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

/** Called when the activity is first created. */
@Override//from w  ww . j av a 2s.c  o  m
public void onCreate(final Bundle savedInstanceState) {
    mApplication = getTweetingsApplication();
    mService = mApplication.getServiceInterface();
    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    super.onCreate(savedInstanceState);
    sendBroadcast(new Intent(BROADCAST_APPLICATION_LAUNCHED));
    final Resources res = getResources();
    mDisplayAppIcon = res.getBoolean(R.bool.home_display_icon);
    final long[] account_ids = getAccountIds(this);
    if (account_ids.length <= 0) {
        startActivity(new Intent(INTENT_ACTION_TWITTER_LOGIN));
        finish();
        return;
    }
    refresh_on_start = mPreferences.getBoolean(PREFERENCE_KEY_REFRESH_ON_START, true);
    bundle = getIntent().getExtras();
    initial_tab = -1;
    mActionBar = getSupportActionBar();
    mActionBar.setCustomView(R.layout.base_tabs);
    mActionBar.setDisplayShowTitleEnabled(false);
    mActionBar.setDisplayShowCustomEnabled(true);
    mActionBar.setDisplayShowHomeEnabled(mDisplayAppIcon);
    if (mDisplayAppIcon && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        SetHomeButtonEnabledAccessor.setHomeButtonEnabled(this, true);
    }
    final View view = mActionBar.getCustomView();

    mProgress = (ProgressBar) view.findViewById(android.R.id.progress);
    mIndicator = (TabPageIndicator) view.findViewById(android.R.id.tabs);
    boolean tab_display_label = res.getBoolean(R.bool.tab_display_label);
    boolean tab_hide_label_always = mPreferences.getBoolean(PREFERENCE_KEY_HIDE_TAB_LABEL, false);
    boolean tab_display_label_always = mPreferences.getBoolean(PREFERENCE_KEY_DISPLAY_TAB_LABEL, false);
    if (tab_display_label_always == true) {
        tab_display_label = true;
    } else if (tab_hide_label_always == true) {
        tab_display_label = false;
    }
    mAdapter = new TabsAdapter(this, getSupportFragmentManager(), mIndicator);
    mAdapter.setDisplayLabel(tab_display_label);
    mShowHomeTab = mPreferences.getBoolean(PREFERENCE_KEY_SHOW_HOME_TAB, true);
    mShowMentionsTab = mPreferences.getBoolean(PREFERENCE_KEY_SHOW_MENTIONS_TAB, true);
    mShowMessagesTab = mPreferences.getBoolean(PREFERENCE_KEY_SHOW_MESSAGES_TAB, true);
    mShowSearchTab = mPreferences.getBoolean(PREFERENCE_KEY_SHOW_SEARCH_TAB, true);
    mShowListsTab = mPreferences.getBoolean(PREFERENCE_KEY_SHOW_LISTS_TAB, true);
    mShowAccountsTab = mPreferences.getBoolean(PREFERENCE_KEY_SHOW_ACCOUNTS_TAB, true);
    initTabs(getTabs(this));
    mViewPager.setAdapter(mAdapter);
    mViewPager.setOffscreenPageLimit(3);
    mIndicator.setViewPager(mViewPager);
    mIndicator.setOnPageChangeListener(this);
    getSupportFragmentManager().addOnBackStackChangedListener(this);

    final boolean remember_position = mPreferences.getBoolean(PREFERENCE_KEY_REMEMBER_POSITION, true);
    final long[] activated_ids = getActivatedAccountIds(this);
    if (activated_ids.length <= 0) {
        startActivityForResult(new Intent(INTENT_ACTION_SELECT_ACCOUNT), REQUEST_SELECT_ACCOUNT);
    } else if (checkDefaultAccountSet() && (remember_position || initial_tab >= 0)) {
        final int position = initial_tab >= 0 ? initial_tab
                : mPreferences.getInt(PREFERENCE_KEY_SAVED_TAB_POSITION, TAB_POSITION_HOME);
        if (position >= 0 || position < mViewPager.getChildCount()) {
            mViewPager.setCurrentItem(position);
        }
    }
    if (refresh_on_start && savedInstanceState == null) {
        mService.getHomeTimelineWithSinceId(activated_ids, null,
                getNewestStatusIdsFromDatabase(this, Statuses.CONTENT_URI));
        mService.getMentionsWithSinceId(account_ids, null,
                getNewestStatusIdsFromDatabase(this, Mentions.CONTENT_URI));
        mService.getReceivedDirectMessagesWithSinceId(activated_ids, null,
                getNewestMessageIdsFromDatabase(this, Inbox.CONTENT_URI));
        //mService.getReceivedDirectMessages(activated_ids, null);

        //mService.getSentDirectMessages(account_ids, null);
    }

    if (!mPreferences.getBoolean(PREFERENCE_KEY_FOLLOW_DIALOG, false)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(getString(R.string.follow_dialog_title));
        builder.setMessage(getString(R.string.follow_dialog));
        builder.setCancelable(true);
        builder.setPositiveButton(getString(R.string.follow), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
                mPreferences.edit().putBoolean(PREFERENCE_KEY_FOLLOW_DIALOG, true).commit();
                final long[] activated_ids = getActivatedAccountIds(mApplication);
                for (final long account_id : activated_ids) {
                    mService.createFriendship(account_id, 41573166);
                }
            }
        });
        builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
                mPreferences.edit().putBoolean(PREFERENCE_KEY_FOLLOW_DIALOG, true).commit();
            }
        });
        //
        AlertDialog alert = builder.create();
        alert.show();
    }

    mStreaming = mPreferences.getBoolean(PREFERENCE_KEY_STREAMING_ENABLED, false);
    mPushNotifications = mPreferences.getBoolean(PREFERENCE_KEY_PUSH_NOTIFICATIONS, false);
    backupManager = new BackupManager(getApplicationContext());
    final IntentFilter filter = new IntentFilter(BROADCAST_BACKGROUND_CHANGED);
    registerReceiver(mStateReceiver2, filter);

}

From source file:com.newcell.calltext.ui.account.AccountsEditListFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(R.string.add_account).setIcon(android.R.drawable.ic_menu_add)
            .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                @Override//from   w  w  w  .  j a v  a 2s.c om
                public boolean onMenuItemClick(MenuItem item) {
                    onClickAddAccount();
                    return true;
                }
            }).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(R.string.reorder).setIcon(android.R.drawable.ic_menu_sort_by_size)
            .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    AccountsEditListAdapter ad = (AccountsEditListAdapter) getListAdapter();
                    ad.toggleDraggable();
                    return true;
                }
            }).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

    menu.add(R.string.backup_restore).setIcon(android.R.drawable.ic_menu_save)
            .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {

                    // Populate choice list
                    List<String> items = new ArrayList<String>();
                    items.add(getResources().getString(R.string.backup));
                    final File backupDir = PreferencesWrapper.getConfigFolder(getActivity());
                    if (backupDir != null) {
                        String[] filesNames = backupDir.list();
                        for (String fileName : filesNames) {
                            items.add(fileName);
                        }
                    }

                    final String[] fItems = (String[]) items.toArray(new String[0]);
                    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                    builder.setTitle(R.string.backup_restore);
                    builder.setItems(fItems, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int item) {
                            if (item == 0) {
                                SipProfileJson.saveSipConfiguration(getActivity());
                            } else {
                                File fileToRestore = new File(backupDir + File.separator + fItems[item]);
                                SipProfileJson.restoreSipConfiguration(getActivity(), fileToRestore);
                            }
                        }
                    });
                    builder.setCancelable(true);
                    AlertDialog backupDialog = builder.create();
                    backupDialog.show();
                    return true;
                }
            });

    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.instiwork.ProfileActivityOther.java

protected void fetchAccount() {
    pbar_profile.setVisibility(View.VISIBLE);
    String url = "";
    try {//from  w ww  .  j a  v a  2s . c om
        url = InstiworkConstants.URL_DOMAIN + "Signup_ios/view_user?userid="
                + getIntent().getStringExtra("bidder_id");
    } catch (Exception e) {
        url = InstiworkConstants.URL_DOMAIN + "Signup_ios/view_user?userid="
                + InstiworkApplication.getInstance().getUSER_ID();
    }
    Logger.showMessage(TAG, "Fetch Contact Details " + url);

    JsonObjectRequest jsonReq = new JsonObjectRequest(Request.Method.GET, url, null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    Logger.showMessage(TAG, response.toString());
                    pbar_profile.setVisibility(View.GONE);
                    try {
                        if (response.getString("status").equalsIgnoreCase("Success")) {

                            try {
                                ((RobotoLight) findViewById(R.id.txt_profile)).setText(
                                        "" + response.getJSONObject("response").getString("name") + "   ");
                            } catch (Exception e) {
                                e.printStackTrace();
                            }

                            ((RobotoLight) findViewById(R.id.prof_company))
                                    .setText("" + response.getJSONObject("response").getString("companyname"));
                            ((RobotoLight) findViewById(R.id.prof_name))
                                    .setText("" + response.getJSONObject("response").getString("name"));
                            ((RobotoLight) findViewById(R.id.prof_email))
                                    .setText("" + response.getJSONObject("response").getString("email"));
                            ((RobotoLight) findViewById(R.id.prof_mobile))
                                    .setText("" + response.getJSONObject("response").getString("Contact"));
                            ((RobotoLight) findViewById(R.id.prof_country))
                                    .setText("" + response.getJSONObject("response").getString("country_name"));

                            if (!response.getJSONObject("response").getString("profileimage")
                                    .equalsIgnoreCase("")) {
                                try {
                                    Picasso.with(getApplicationContext())
                                            .load(response.getJSONObject("response").getString("profileimage"))
                                            .fit().centerInside().error(R.mipmap.ic_no_image)
                                            .into(((ImageView) findViewById(R.id.profile_request_details)));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    Picasso.with(getApplicationContext()).load(R.mipmap.ic_no_image).fit()
                                            .centerInside().error(R.mipmap.ic_no_image)
                                            .into(((ImageView) findViewById(R.id.profile_request_details)));
                                }
                            } else {
                                Picasso.with(getApplicationContext()).load(R.mipmap.ic_no_image).fit()
                                        .centerInside().error(R.mipmap.ic_no_image)
                                        .into(((ImageView) findViewById(R.id.profile_request_details)));
                            }

                            try {
                                licenseLinkedList = new LinkedList<JSONObject>();
                                if (response.getJSONObject("response").getJSONArray("license").length() > 0) {
                                    for (int i = 0; i < response.getJSONObject("response")
                                            .getJSONArray("license").length(); i++) {
                                        licenseLinkedList.add(response.getJSONObject("response")
                                                .getJSONArray("license").getJSONObject(i));
                                    }
                                }
                                if (licenseLinkedList == null) {
                                    ((RobotoLight) findViewById(R.id.no_license)).setVisibility(View.VISIBLE);
                                    license_list.setVisibility(View.GONE);
                                } else {
                                    try {
                                        if (licenseLinkedList.size() > 0) {
                                            ((RobotoLight) findViewById(R.id.no_license))
                                                    .setVisibility(View.GONE);
                                            license_list.setVisibility(View.VISIBLE);
                                            ProfileLicenseListAdapter profileLicenseListAdapter = new ProfileLicenseListAdapter(
                                                    ProfileActivityOther.this, licenseLinkedList);
                                            license_list.setItemAnimator(new DefaultItemAnimator());
                                            license_list.setAdapter(profileLicenseListAdapter);
                                            license_list.setLayoutManager(
                                                    new LinearLayoutManager(getApplicationContext(),
                                                            LinearLayoutManager.HORIZONTAL, false));
                                        } else {
                                            ((RobotoLight) findViewById(R.id.no_license))
                                                    .setVisibility(View.VISIBLE);
                                            license_list.setVisibility(View.GONE);
                                        }
                                    } catch (Exception ee) {

                                        ee.printStackTrace();

                                        ((RobotoLight) findViewById(R.id.no_license))
                                                .setVisibility(View.VISIBLE);
                                        license_list.setVisibility(View.GONE);
                                    }
                                }
                            } catch (Exception e) {
                                InstiworkApplication.getInstance().setLicenseArray(null);
                                Logger.showMessage(TAG, "license Exception" + e.toString());
                            }
                        } else if (response.getString("status").equalsIgnoreCase("Error")) {
                            if (response.getJSONObject("response").getString("message")
                                    .equalsIgnoreCase("No user details found")) {
                                Snackbar.make(findViewById(android.R.id.content),
                                        response.getJSONObject("response").getString("message"),
                                        Snackbar.LENGTH_LONG).setActionTextColor(Color.RED).show();
                            } else {
                                Snackbar.make(findViewById(android.R.id.content),
                                        response.getJSONObject("response").getString("message"),
                                        Snackbar.LENGTH_LONG).setActionTextColor(Color.RED).show();
                            }
                        } else {
                            Snackbar.make(findViewById(android.R.id.content),
                                    response.getJSONObject("response").getString("message"),
                                    Snackbar.LENGTH_LONG).setActionTextColor(Color.RED).show();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        //                            pDialog.dismiss();
                    }
                }
            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError volleyError) {
                    Logger.showMessage(TAG, "error is::" + volleyError.toString());
                    pbar_profile.setVisibility(View.GONE);
                    if (volleyError instanceof NoConnectionError) {
                        AlertDialog.Builder builder = new AlertDialog.Builder(ProfileActivityOther.this);
                        builder.setTitle("Instiwork");
                        builder.setMessage("You do not have internet connection!");
                        builder.setPositiveButton("ok", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                dialog.dismiss();
                                fetchAccount();
                            }
                        });
                        builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                dialog.dismiss();
                                onBackPressed();
                            }
                        });
                        builder.setCancelable(false);
                        builder.show();
                    } else {
                        try {
                            String json = null;
                            NetworkResponse response = volleyError.networkResponse;
                            if (response != null && response.data != null) {
                                json = new String(response.data);
                                json = trimMessage(json, "message");
                                if (json != null)
                                    displayMessage(json);
                                //                            displayMessage(json + " Error Code : " + response.statusCode);
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            });
    jsonReq.setRetryPolicy(new DefaultRetryPolicy(10000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
    InstiworkApplication.getInstance().addToRequestQueue(jsonReq);
}

From source file:gr.scify.newsum.ui.ViewActivity.java

protected void showHelpDialog() {
    SharedPreferences setvmassage = getSharedPreferences("dialog", 0);
    boolean dialogShown = setvmassage.getBoolean("dialogShown", false);

    if (!dialogShown) {
        // prepare the alert box
        AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
        alertbox.setMessage(R.string.view_massage);
        alertbox.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
            }//from ww  w .  jav a2  s  .  co  m
        });
        alertbox.setCancelable(false);
        alertbox.show();

        SharedPreferences.Editor editor = setvmassage.edit();
        editor.putBoolean("dialogShown", true);
        editor.commit();
    }

}

From source file:com.pax.pay.record.TransQueryActivity.java

private void selectAcquirer() {
    List<Acquirer> list = DbManager.getAcqDao().findAllAcquirers();
    final String[] acqNames = new String[list.size()];

    for (int i = 0; i < list.size(); ++i) {
        acqNames[i] = list.get(i).getName();
    }/*from  w  w w. j  ava2 s  . co m*/
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(R.string.acq_select_hint));

    builder.setSingleChoiceItems(acqNames, -1, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface arg0, int arg1) {
            acquirerName = acqNames[arg1];
            FinancialApplication.mApp.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pager.setAdapter(new MyAdapter(getSupportFragmentManager(), titles));
                    tabs.setViewPager(pager);
                }
            });

            arg0.dismiss();
        }
    });

    builder.setPositiveButton(getString(R.string.dialog_cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface arg0, int arg1) {
            setResult(100);
            finish();
            arg0.dismiss();
        }
    });
    builder.setCancelable(false);
    builder.create().show();
}

From source file:com.barkside.travellocblog.LocationUpdates.java

@Override
public void onResume() {
    super.onResume();
    Log.d(TAG, "onResume");
    // If user has turned off location services, there will never be location
    // event - neither onConnected nor onLocationChanged. Detect that and report to user.
    if (mUpdatesRequested && !isLocationServiceOn()) {
        if (mDisplayedServiceOffMessage) {
            // We display the dialog only once, after that, just a Toast is enough
            Toast.makeText(this, R.string.no_location_services_message, Toast.LENGTH_SHORT).show();
        } else {/*from  w w  w  .  java 2s  .c  o  m*/
            // First time in, display a warning dialog about turning on location services.
            mDisplayedServiceOffMessage = true;
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage(this.getString(R.string.no_location_services_message));
            builder.setTitle(this.getString(R.string.no_location_services_title));
            builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
            builder.setCancelable(true);
            builder.create().show();
        }
    }
}

From source file:com.speed.traquer.app.TraqComplaintTaxi.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK)) {
        final AlertDialog.Builder alertBox = new AlertDialog.Builder(TraqComplaintTaxi.this);
        alertBox.setIcon(R.drawable.info_icon);
        alertBox.setCancelable(false);
        alertBox.setTitle("Do you want to cancel complaint?");
        alertBox.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                // finish used for destroyed activity
                easyTracker.send(MapBuilder
                        .createEvent("Complaint", "Cancel Complaint (Yes)", "Complaint event", null).build());
                NavUtils.navigateUpFromSameTask(TraqComplaintTaxi.this);
            }//from   ww w  .ja  va2  s .c  om
        });

        alertBox.setNegativeButton("No", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int arg1) {
                easyTracker.send(MapBuilder
                        .createEvent("Complaint", "Cancel Complaint (No)", "Complaint event", null).build());
                dialog.cancel();
            }
        });

        alertBox.show();
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.corporatetaxi.TaxiOntheWay_Activity.java

public void caceldialog() {

    AlertDialog.Builder builder = new AlertDialog.Builder(TaxiOntheWay_Activity.this);
    //builder.setTitle(getString(R.string.cancel_trip));
    //builder.setIcon(R.drawable.ic_launcher);
    LayoutInflater inflater = getLayoutInflater();
    View header = inflater.inflate(R.layout.dialog_heading, null);
    TextView textView = (TextView) header.findViewById(R.id.text);
    ImageView icon = (ImageView) header.findViewById(R.id.icon);
    icon.setImageResource(R.drawable.ic_launcher);
    textView.setText("Taxi On The Way");
    builder.setCustomTitle(header);/*ww  w .  j  a v  a2 s . c  o  m*/
    builder.setCancelable(false);

    builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            //                        AppPreferences.setTripId(DrawerMainActivity.this, "");
            //                        AppPreferences.setDriverId(DrawerMainActivity.this, "");
            dialog.dismiss();
        }
    });

    builder.show();
}

From source file:com.gsma.rcs.ri.messaging.GroupTalkView.java

/**
 * Display notification to accept or reject invitation
 *
 * @param remote remote contact//from w w w  .j  a  v  a 2s .  c  o m
 */
private void displayAcceptRejectDialog(ContactId remote) {
    /* Manual accept */
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.title_group_chat);
    String from = RcsContactUtil.getInstance(this).getDisplayName(remote);
    String topic = (TextUtils.isEmpty(mSubject)) ? getString(R.string.label_no_subject) : mSubject;
    String msg = getString(R.string.label_gc_from_subject, from, topic);
    builder.setMessage(msg);
    builder.setCancelable(false);
    builder.setIcon(R.drawable.ri_notif_chat_icon);
    builder.setPositiveButton(R.string.label_accept, new android.content.DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            try {
                /* Accept the invitation */
                mGroupChat.openChat();
            } catch (RcsServiceException e) {
                showExceptionThenExit(e);
            }
        }
    });
    builder.setNegativeButton(R.string.label_decline, new android.content.DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            /*
             * Let session die by timeout. Exit activity
             */
            finish();
        }
    });
    registerDialog(builder.show());
}

From source file:com.shiz.flighttime.dialog.DeleteItemDialog.java

@NonNull
@Override//from   w w  w  .  j  a  v a2  s.  c om
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(),
            android.R.style.Theme_Material_Dialog_Alert);

    final int groupPosition = getArguments().getInt(KEY_GROUP_ITEM_POSITION, Integer.MIN_VALUE);
    final int childPosition = getArguments().getInt(KEY_CHILD_ITEM_POSITION, Integer.MIN_VALUE);
    Log.d("Delete", "groupPosition" + groupPosition + " " + childPosition);
    // for expandable list
    if (childPosition == RecyclerView.NO_POSITION) {
        builder.setMessage(getResources().getString(R.string.dialog_deleted_mission));
    } else {
        builder.setMessage(getResources().getString(R.string.dialog_deleted_flight));
    }
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (childPosition == RecyclerView.NO_POSITION)
                listener.onClickToDeleteMission(groupPosition);
            else
                listener.onClickToDeleteFlight(groupPosition, childPosition);
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    builder.setCancelable(true);
    return builder.create();
}