Example usage for android.app AlertDialog.Builder AlertDialog.Builder

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

Introduction

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

Prototype

public Builder(Context context) 

Source Link

Document

Creates a builder for an alert dialog that uses the default alert dialog theme.

Usage

From source file:com.denel.facepatrol.MainActivity.java

@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    // TODO: Implement this method
    switch (item.getItemId()) {
    case R.id.action_settings:
        Intent intent1 = new Intent(this, Settings.class);
        startActivity(intent1);//from   ww w.j a v a  2s . co  m
        return true;
    case R.id.action_download:
        try {
            downloadunzip();
        } catch (IOException e) {
        }
        return true;
    case R.id.main_help:
        // start activity using dummy class
        run_quick_tips();
        //Intent intent = new Intent(this,dummypage.class);
        //intent.putExtra("title","Help");
        //startActivity(intent); 
        return true;
    case R.id.main_about:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("About").setMessage(R.string.about).setPositiveButton("OK",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // FIRE ZE MISSILES! 
                    }
                });
        //.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 
        //   public void onClick(DialogInterface dialog, int id) { 
        // User cancelled the dialog 
        //} });
        builder.show();
        return true;
    case R.id.action_exit:
        // exit the application
        finish();
        return true;
    }
    return super.onMenuItemSelected(featureId, item);
}

From source file:com.denel.facepatrol.MainActivity.java

public void run_quick_tips() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Quick Tips").setMessage(R.string.quick_tips).setPositiveButton("OK",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    // FIRE ZE MISSILES! 
                }/*  w ww. ja va2s  . c o m*/
            });
    //.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 
    //   public void onClick(DialogInterface dialog, int id) { 
    // User cancelled the dialog 
    //} });
    builder.show();
}

From source file:nl.mpcjanssen.simpletask.Simpletask.java

private void prioritizeTasks(@NotNull final List<Task> tasks) {
    List<String> strings = Priority.rangeInCode(Priority.NONE, Priority.Z);
    final String[] prioArr = strings.toArray(new String[strings.size()]);

    int prioIdx = 0;
    if (tasks.size() == 1) {
        prioIdx = strings.indexOf(tasks.get(0).getPriority().getCode());
    }//from   w  w w. ja  v  a2s .  c  o  m
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.select_priority);
    builder.setSingleChoiceItems(prioArr, prioIdx, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(@NotNull DialogInterface dialog, final int which) {
            dialog.dismiss();
            Priority prio = Priority.toPriority(prioArr[which]);
            ArrayList<String> originalTasks = Util.tasksToString(tasks);
            for (Task t : tasks) {
                t.setPriority(prio);
            }
            getTaskBag().modify(originalTasks, tasks, null, null);
            finishActionmode();
        }
    });
    builder.show();

}

From source file:com.free.searcher.MainFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewContainer, Bundle savedInstanceState) {

    super.onCreateView(inflater, viewContainer, savedInstanceState);
    this.activity = getActivity();
    actionBar = activity.getActionBar();

    View v = inflater.inflate(R.layout.main, viewContainer, false);
    v.setOnSystemUiVisibilityChangeListener(this);

    webView = (WebView) v.findViewById(R.id.webView1);
    statusView = (TextView) v.findViewById(R.id.statusView);

    if (webViewBundle != null) {
        webView.restoreState(webViewBundle);
        Log.d("onCreateView.webView.restoreState", webViewBundle + "");
    } else if (currentUrl.length() > 0) {
        Log.d("onCreateView.locX, locY", locX + ", " + locY + ", " + currentUrl);
        webView.loadUrl(currentUrl);/*  w ww.  jav a2  s.com*/
        webView.setScrollX(locX);
        webView.setScrollY(locY);
        Log.d("currentUrl 8", currentUrl);
    }
    statusView.setText(status);

    Log.d("onCreateView.savedInstanceState", savedInstanceState + "vvv");
    mNotificationManager = (NotificationManager) activity.getSystemService(activity.NOTIFICATION_SERVICE);

    webView.setFocusable(true);
    webView.setFocusableInTouchMode(true);
    webView.requestFocus();
    webView.requestFocusFromTouch();
    webView.getSettings().setAllowContentAccess(false);
    webView.getSettings().setPluginState(WebSettings.PluginState.OFF);
    // webView.setBackgroundColor(LIGHT_BLUE);
    webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    webView.setBackgroundColor(getResources().getColor(R.color.lightyellow));

    webView.setOnLongClickListener(this);
    statusView.setOnLongClickListener(this);

    webView.setWebViewClient(new WebViewClient() {

        private void jumpTo(final int xLocation, final int yLocation) {
            webView.postDelayed(new Runnable() {
                @Override
                public void run() {
                    Log.d("jumpTo1.locX, locY", xLocation + ", " + yLocation + ", " + currentUrl);
                    try {
                        webView.scrollTo(xLocation, yLocation);
                        webView.setScrollX(xLocation);
                        webView.setScrollY(yLocation);
                        //                           locX = 0;
                        //                           locY = 0;
                    } catch (RuntimeException e) {
                        Log.e("error jumpTo2.locX, locY", locX + ", " + locY + ", " + currentUrl);
                    }
                }
            }, 100);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, final String url) {
            if (currentZipFileName.length() > 0 && (extractFile == null || extractFile.isClosed())) {
                try {
                    extractFile = new ExtractFile(currentZipFileName,
                            MainFragment.PRIVATE_PATH + currentZipFileName);
                } catch (RarException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            int ind = url.indexOf("?deleteFile=");
            if (ind >= 0) {
                if (dupTask == null) {
                    showToast("Please do duplicate finding again.");
                    return true;
                }

                String urlStatus = Util.getUrlStatus(url);
                final String selectedFile = urlStatus.substring(urlStatus.indexOf("?deleteFile=") + 12,
                        urlStatus.length());
                Log.d("deleteFile", "url=" + url + ", urlStatus=" + urlStatus);

                AlertDialog.Builder alert = new AlertDialog.Builder(activity);
                alert.setTitle("Delete File?");
                alert.setMessage("Do you really want to delete file \"" + selectedFile + "\"?");
                alert.setCancelable(true);
                alert.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        try {
                            locX = webView.getScrollX();
                            locY = webView.getScrollY();
                            webView.loadUrl(
                                    new File(dupTask.deleteFile(selectedFile)).toURI().toURL().toString());
                        } catch (IOException e) {
                            statusView.setText(e.getMessage());
                            Log.d("deleteFile", e.getMessage(), e);
                        }
                    }
                });
                alert.setPositiveButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });
                AlertDialog alertDialog = alert.create();
                alertDialog.show();
                return true;
            }

            ind = url.indexOf("?deleteGroup=");
            if (ind >= 0) {
                if (dupTask == null) {
                    showToast("Please do duplicate finding again.");
                    return true;
                }

                String urlStatus = Util.getUrlStatus(url);
                final String groupFile = urlStatus.substring(urlStatus.indexOf("?deleteGroup=") + 13,
                        urlStatus.length());
                int indexOf = groupFile.indexOf(",");
                final int group = Integer.parseInt(groupFile.substring(0, indexOf));
                final String selectedFile = groupFile.substring(indexOf + 1);
                Log.d("groupFile", ",groupFile=" + groupFile + ", url=" + url + ", urlStatus=" + urlStatus);

                AlertDialog.Builder alert = new AlertDialog.Builder(activity);
                alert.setTitle("Delete Group of Files?");
                alert.setMessage(
                        "Do you really want to delete this group, except file \"" + selectedFile + "\"?");
                alert.setCancelable(true);
                alert.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        locX = webView.getScrollX();
                        locY = webView.getScrollY();
                        webView.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    webView.loadUrl(new File(dupTask.deleteGroup(group, selectedFile)).toURI()
                                            .toURL().toString());
                                } catch (Throwable e) {
                                    statusView.setText(e.getMessage());
                                    Log.e("Delete Group", e.getMessage(), e);
                                    Log.e("Delete Group", locX + ", " + locY + ", " + currentUrl);
                                }
                            }
                        }, 0);
                    }
                });
                alert.setPositiveButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });
                AlertDialog alertDialog = alert.create();
                alertDialog.show();
                return true;
            }

            ind = url.indexOf("?deleteFolder=");
            if (ind >= 0) {
                if (dupTask == null) {
                    showToast("Please do duplicate finding again.");
                    return true;
                }

                String urlStatus = Util.getUrlStatus(url);
                final String selectedFile = urlStatus.substring(urlStatus.indexOf("?deleteFolder=") + 14,
                        urlStatus.length());
                Log.d("deleteFolder",
                        ",deleteFolder=" + selectedFile + ", url=" + url + ", urlStatus=" + urlStatus);
                AlertDialog.Builder alert = new AlertDialog.Builder(activity);
                alert.setTitle("Delete folder?");
                alert.setMessage("Do you really want to delete duplicate in folder \""
                        + selectedFile.substring(0, selectedFile.lastIndexOf("/")) + "\"?");
                alert.setCancelable(true);
                alert.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        locX = webView.getScrollX();
                        locY = webView.getScrollY();
                        webView.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    webView.loadUrl(new File(dupTask.deleteFolder(selectedFile)).toURI().toURL()
                                            .toString());
                                } catch (Throwable e) {
                                    statusView.setText(e.getMessage());
                                    Log.e("Delete folder", e.getMessage(), e);
                                    Log.e("Delete folder", locX + ", " + locY + ", " + currentUrl);
                                }
                            }
                        }, 0);
                    }
                });
                alert.setPositiveButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });
                AlertDialog alertDialog = alert.create();
                alertDialog.show();
                return true;
            }

            ind = url.indexOf("?deleteSub=");
            if (ind >= 0) {
                if (dupTask == null) {
                    showToast("Please do duplicate finding again.");
                    return true;
                }

                String urlStatus = Util.getUrlStatus(url);

                final String selectedFile = urlStatus.substring(urlStatus.indexOf("?deleteSub=") + 11,
                        urlStatus.length());
                Log.d("deleteSub", ",deleteSub=" + selectedFile + ", url=" + url + ", urlStatus=" + urlStatus);
                AlertDialog.Builder alert = new AlertDialog.Builder(activity);
                alert.setTitle("Delete sub folder?");
                alert.setMessage("Do you really want to delete duplicate files in sub folder of \""
                        + selectedFile.substring(0, selectedFile.lastIndexOf("/")) + "\"?");
                alert.setCancelable(true);
                alert.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        locX = webView.getScrollX();
                        locY = webView.getScrollY();
                        webView.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    webView.loadUrl(new File(dupTask.deleteSubFolder(selectedFile)).toURI()
                                            .toURL().toString());
                                } catch (Throwable e) {
                                    statusView.setText(e.getMessage());
                                    Log.e("Delete sub folder", e.getMessage(), e);
                                    Log.e("Delete sub folder", locX + ", " + locY + ", " + currentUrl);
                                }
                            }
                        }, 0);
                    }
                });
                alert.setPositiveButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });
                AlertDialog alertDialog = alert.create();
                alertDialog.show();
                return true;
            }

            ind = url.indexOf("?viewName");
            if (ind >= 0) {
                if (dupTask == null) {
                    showToast("Please do duplicate finding again.");
                    return true;
                }
                nameOrder = !nameOrder;
                locX = 0;
                locY = 0;
                Log.d("url=", url + ", viewName");
                try {
                    webView.loadUrl(new File(dupTask.genFile(dupTask.groupList, dupTask.NAME_VIEW)).toURI()
                            .toURL().toString());
                } catch (IOException e) {
                    Log.e("viewName", e.getMessage(), e);
                }
                return true;
            }

            ind = url.indexOf("?viewGroup");
            if (ind >= 0) {
                if (dupTask == null) {
                    showToast("Please do duplicate finding again.");
                    return true;
                }
                groupViewChanged = true;
                locX = 0;
                locY = 0;
                Log.d("url=", url + ", viewGroup");
                try {
                    webView.loadUrl(new File(dupTask.genFile(dupTask.groupList, dupTask.GROUP_VIEW)).toURI()
                            .toURL().toString());
                } catch (IOException e) {
                    Log.e("viewGroup", e.getMessage(), e);
                }
                return true;
            }
            if (zextr == null) {
                locX = 0;
                locY = 0;
            } else {
                zextr = null;
            }

            if (MainActivity.popup) {
                final MainFragment frag = ((MainActivity) activity).addFragmentToStack();
                frag.status = Util.getUrlStatus(url);
                frag.load = load;
                frag.currentSearching = currentSearching;
                frag.selectedFiles = selectedFiles;
                frag.files = files;
                frag.currentZipFileName = currentZipFileName;
                if (extractFile != null) {
                    try {
                        frag.extractFile = new ExtractFile();
                        extractFile.copyTo(frag.extractFile);
                    } catch (RarException e) {
                        e.printStackTrace();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

                frag.home = home;
                //                  if (mSearchView != null && mSearchView.getQuery().length() > 0) {
                //                     frag.mSearchView.setQuery(mSearchView.getQuery(), false);
                //                  }
                view.getHandler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        frag.webTask = new WebTask(MainFragment.this);
                        frag.webTask.init(frag.webView, url);
                        frag.webTask.execute();
                        frag.statusView.setText(frag.status);
                    }
                }, 100);
            } else {
                currentUrl = url;
                Log.d("currentUrl 19", currentUrl);
                status = Util.getUrlStatus(url);
                statusView.setText("Opening " + url + "...");
                webTask = new WebTask(MainFragment.this, webView, url, status.toString());
                webTask.execute();
            }
            //               setNavVisibility(false);
            return true;
        }

        //         @Override
        //         public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
        //         }

        @Override
        public void onPageFinished(WebView view, String url) {
            if (container != null) {
                if (showFind) {
                    container.setVisibility(View.VISIBLE);
                    webView.findAllAsync(findBox.getText().toString());
                } else {
                    container.setVisibility(View.INVISIBLE);
                }
            }
            Log.d("onPageFinished", locX + ", " + locY + ", currentUrl=" + currentUrl + ", url=" + url);
            setNavVisibility(false);
            if (!backForward) { //if (zextr != null) {
                // zextr = null;
                jumpTo(locX, locY);
            } else {
                backForward = false;
            }
            //               locX = 0;
            //               locY = 0;
            Log.d("onPageFinished", url);
            /* This call inject JavaScript into the page which just finished loading. */
            //              webView.loadUrl("javascript:window.HTMLOUT.processHTML(" +
            //                    "'<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
        }
    });

    WebSettings settings = webView.getSettings();
    //      webView.setWebViewClient(new WebViewClient());
    //      webView.setWebChromeClient(new WebChromeClient());
    //      webView.addJavascriptInterface(new HtmlSourceViewJavaScriptInterface(), "HTMLOUT");
    settings.setMinimumFontSize(13);
    settings.setJavaScriptEnabled(true);
    settings.setDefaultTextEncodingName("UTF-8");
    settings.setBuiltInZoomControls(true);
    // settings.setSansSerifFontFamily("Tahoma");
    settings.setEnableSmoothTransition(true);

    return v;
}

From source file:com.ibuildapp.romanblack.NewsPlugin.NewsPlugin.java

/**
 * Show RSS feed list.//from   w  w w.  j  a  v  a2s  . c om
 * Called when func = "events"
 */
private void showEvents() {
    try {

        Log.e("ibuildapp time", "Show events start " + new Date(System.currentTimeMillis()));
        setTitle(title);
        if (items.isEmpty()) {
            return;
        }

        progressLayout.setVisibility(View.GONE);
        listView.setAdapter(new RvEventsAdapter(this, items));

        if (widget.hasParameter("add_local_notific")) {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage(getString(R.string.news_dialog_add_notification));
            builder.setPositiveButton(getString(R.string.news_yes), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface arg0, int arg1) {
                    handler.sendEmptyMessage(ADD_NOTIFICATIONS);
                }
            });
            builder.setNegativeButton(getString(R.string.news_no), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface arg0, int arg1) {
                }
            });
            builder.create().show();
        }

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:no.digipost.android.gui.MainContentActivity.java

private void openExternalHelpUrl() {
    new AlertDialog.Builder(this).setMessage(getString(R.string.dialog_prompt_open_help_new_window))
            .setPositiveButton(getString(R.string.open), new DialogInterface.OnClickListener() {
                @Override/* w  w w  . j a v a 2s  .  c  o  m*/
                public void onClick(DialogInterface dialog, int which) {
                    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ApiConstants.URL_HELP));
                    startActivity(browserIntent);
                }
            }).setNegativeButton(getString(R.string.abort), null).show();
}

From source file:nl.mpcjanssen.simpletask.Simpletask.java

/**
 * Handle add filter click *// www  .  j a v a 2  s . co  m
 */
public void onAddFilterClick(View v) {
    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle(R.string.save_filter);
    alert.setMessage(R.string.save_filter_message);

    // Set an EditText view to get user input
    final EditText input = new EditText(this);
    alert.setView(input);
    input.setText(mFilter.getProposedName());

    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            Editable text = input.getText();
            String value;
            if (text == null) {
                value = "";
            } else {
                value = text.toString();
            }
            if (value.equals("")) {
                Util.showToastShort(getApplicationContext(), R.string.filter_name_empty);
            } else {
                SharedPreferences saved_filters = getSharedPreferences("filters", MODE_PRIVATE);
                int newId = saved_filters.getInt("max_id", 1) + 1;
                Set<String> filters = saved_filters.getStringSet("ids", new HashSet<String>());
                filters.add("filter_" + newId);
                saved_filters.edit().putStringSet("ids", filters).putInt("max_id", newId).apply();
                SharedPreferences test_filter_prefs = getSharedPreferences("filter_" + newId, MODE_PRIVATE);
                mFilter.setName(value);
                mFilter.saveInPrefs(test_filter_prefs);
                updateRightDrawer();
            }
        }
    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
        }
    });

    alert.show();
}

From source file:nl.mpcjanssen.simpletask.Simpletask.java

private void renameSavedFilter(String prefsName) {
    final SharedPreferences filter_pref = getSharedPreferences(prefsName, MODE_PRIVATE);
    ActiveFilter old_filter = new ActiveFilter();
    old_filter.initFromPrefs(filter_pref);
    String filterName = old_filter.getName();
    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle(R.string.rename_filter);
    alert.setMessage(R.string.rename_filter_message);

    // Set an EditText view to get user input
    final EditText input = new EditText(this);
    alert.setView(input);/*  w  ww.ja  v a 2s.  com*/
    input.setText(filterName);

    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            Editable text = input.getText();
            String value;
            if (text == null) {
                value = "";
            } else {
                value = text.toString();
            }
            if (value.equals("")) {
                Util.showToastShort(getApplicationContext(), R.string.filter_name_empty);
            } else {
                mFilter.setName(value);
                mFilter.saveInPrefs(filter_pref);
                updateRightDrawer();
            }
        }
    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
        }
    });

    alert.show();
}

From source file:nf.frex.android.FrexActivity.java

public static void showYesNoDialog(Context context, int titleId, String message,
        DialogInterface.OnClickListener yesListener, DialogInterface.OnClickListener noListener,
        DialogInterface.OnCancelListener cancelListener) {

    TextView textView = new TextView(context);
    textView.setSingleLine(false);/*from w  ww .j a  va2  s. c o m*/
    textView.setPadding(10, 10, 10, 10);
    textView.setText(message);

    AlertDialog.Builder b = new AlertDialog.Builder(context);
    b.setTitle(titleId);
    b.setView(textView);
    b.setCancelable(true);
    if (yesListener != null) {
        b.setPositiveButton(android.R.string.yes, yesListener);
    }
    if (noListener != null) {
        b.setNegativeButton(android.R.string.no, noListener);
    }
    if (cancelListener != null) {
        b.setOnCancelListener(cancelListener);
    }
    b.show();
}

From source file:nl.mpcjanssen.simpletask.Simpletask.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Task t = getTaskAt(position);// w  ww .  j  a  v  a 2 s  .co  m
    final ArrayList<String> actions = new ArrayList<>();
    final ArrayList<String> links = new ArrayList<>();

    for (String link : t.getLinks()) {
        actions.add(ACTION_LINK);
        links.add(link);
    }

    for (String number : t.getPhoneNumbers()) {
        actions.add(ACTION_PHONE);
        links.add(number);
    }

    for (String mail : t.getMailAddresses()) {
        actions.add(ACTION_MAIL);
        links.add(mail);
    }

    final String[] linksArray = links.toArray(new String[0]);
    if (linksArray.length == 0) {
        getListView().setItemChecked(position, !getListView().isItemChecked(position));
    } else {
        AlertDialog.Builder build = new AlertDialog.Builder(this);
        build.setItems(linksArray, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Intent intent;
                String url = links.get(which);
                Log.v(TAG, "" + actions.get(which) + ": " + url);
                switch (actions.get(which)) {
                case ACTION_LINK:
                    if (url.startsWith("todo://")) {
                        File todoFolder = m_app.getTodoFile().getParentFile();
                        File newName = new File(todoFolder, url.substring(7));
                        m_app.switchTodoFile(newName);
                    } else {
                        intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                        startActivity(intent);
                    }
                    break;
                case ACTION_PHONE:
                    String encodedNumber = Uri.encode(url);
                    intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + encodedNumber));
                    startActivity(intent);
                    break;
                case ACTION_MAIL:
                    intent = new Intent(Intent.ACTION_SEND, Uri.parse(url));
                    intent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { url });
                    intent.setType("text/plain");
                    startActivity(intent);

                }
            }
        });
        build.create().show();
    }
    return;
}