Example usage for android.app AlertDialog setTitle

List of usage examples for android.app AlertDialog setTitle

Introduction

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

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:org.mixare.MixMenu.java

public void selectItem(int position) {
    switch (position) {
    /* Data sources */
    case 0:/* ww w. j  a va 2  s .c  o  m*/
        Intent intent = new Intent(MixMenu.this, DataSourceList.class);
        startActivityForResult(intent, 40);
        break;
    /* Plugin View */
    case 1:
        Intent intent2 = new Intent(MixMenu.this, PluginListActivity.class);
        startActivityForResult(intent2, 35);
        break;
    /* List markerRenderer */
    case 2:
        Intent intent3 = new Intent(MixMenu.this, MixListView.class);
        intent3.setAction(Intent.ACTION_VIEW);
        startActivityForResult(intent3, 42);
        break;
    /* Map View */
    case 3:
        Intent intent4 = new Intent(MixMenu.this, MixMap.class);
        startActivityForResult(intent4, 20);
        break;
    /* range level */
    case 4:
        // only sense in MixViewActivity, overridden there
        break;
    /* Search */
    case 5:
        onSearchRequested();
        break;
    /* GPS Information */
    case 6:
        // only sense in MixViewActivity, overridden there
        break;
    /* Case 6: license agreements */
    case 7:
        AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
        builder1.setMessage(getString(R.string.license));
        /* Retry */
        builder1.setNegativeButton(getString(R.string.close_button), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.dismiss();
            }
        });
        AlertDialog alert1 = builder1.create();
        alert1.setTitle(getString(R.string.license_title));
        alert1.show();
        break;
    case 8:
        break;

    }
}

From source file:com.google.cast.samples.games.spellcast.MainActivity.java

/**
 * Shows an error dialog./*from   w  ww  .j ava  2 s  .c o m*/
 *
 * @param errorMessage The message to show in the dialog.
 */
private void showErrorDialog(final String errorMessage) {
    if (!isDestroyed()) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                // Show a error dialog along with error messages.
                AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
                alertDialog.setTitle(getString(R.string.game_connection_error_message));
                alertDialog.setMessage(errorMessage);
                alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL,
                        getString(R.string.game_dialog_ok_button_text), new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                            }
                        });
                alertDialog.show();
            }
        });
    }
}

From source file:org.openremote.android.console.view.PanelSelectSpinnerView.java

@Override
public void urlConnectionDidReceiveResponse(HttpResponse httpResponse) {
    int statusCode = httpResponse.getStatusLine().getStatusCode();
    if (statusCode != Constants.HTTP_SUCCESS) {
        if (statusCode == ControllerException.UNAUTHORIZED) {
            LoginDialog loginDialog = new LoginDialog(getContext());
            loginDialog.setOnClickListener(loginDialog.new OnloginClickListener() {
                @Override//  w ww .  ja va 2  s.com
                public void onClick(View v) {
                    super.onClick(v);
                    requestPanelList(getContext(), PanelSelectSpinnerView.this);
                }

            });
        } else {
            // The following code customizes the dialog, because the finish method should do after dialog show and click ok.
            AlertDialog alertDialog = new AlertDialog.Builder(getContext()).create();
            alertDialog.setTitle("Panel List Not Found");
            alertDialog.setMessage(ControllerException.exceptionMessageOfCode(statusCode));
            alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    return;
                }
            });
            alertDialog.show();
            setDefaultAdapterContent();
        }
    }
}

From source file:net.networksaremadeofstring.cyllell.Search.java

public void MakeHandler() {
    handler = new Handler() {
        public void handleMessage(Message msg) {
            //Once we've checked the data is good to use start processing it
            if (msg.what == 0) {
                //TODO ListView population
                NodeAdapter = new NodeListAdaptor(Search.this, listOfNodes);
                list.setAdapter(NodeAdapter);

                //Close the Progress dialog
                dialog.dismiss();// w w w .  j  av a 2  s.  c  om
            } else if (msg.what == 200) {
                dialog.setMessage("Searching for: " + query + "\n\nSending request to Chef...");
            } else if (msg.what == 201) {
                dialog.setMessage("Parsing JSON.....");
            } else if (msg.what == 202) {
                dialog.setMessage("Populating UI!");
            } else {
                //Close the Progress dialog
                dialog.dismiss();

                //Alert the user that something went terribly wrong
                AlertDialog alertDialog = new AlertDialog.Builder(Search.this).create();
                alertDialog.setTitle("API Error");
                alertDialog.setMessage("There was an error communicating with the API:\n"
                        + msg.getData().getString("exception"));
                alertDialog.setButton2("Back", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        Search.this.finish();
                    }
                });
                alertDialog.setIcon(R.drawable.error);
                alertDialog.show();
            }

        }
    };
}

From source file:es.uja.photofirma.android.SignUpActivity.java

/**
 * Advertencia a cerca de la privacidad del usuario, el usuario ser notificado
 * // ww  w .  j  av a 2s . c  o  m
 */
public void onTermsOfUse(View view) {
    final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle("Terminos de uso");
    alertDialog.setMessage(getString(R.string.terms_of_use));
    alertDialog.setCancelable(false);
    alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
        }
    });
    alertDialog.show();

}

From source file:com.abcvoipsip.ui.calllog.CallLogListFragment.java

private void deleteAllCalls() {
    AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
    alertDialog.setTitle(R.string.callLog_delDialog_title);
    alertDialog.setMessage(getString(R.string.callLog_delDialog_message));
    alertDialog.setButton(getString(R.string.callLog_delDialog_yes), new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            getActivity().getContentResolver().delete(SipManager.CALLLOG_URI, null, null);
        }/*from   www  . jav a2s.c  om*/
    });
    alertDialog.setButton2(getString(R.string.callLog_delDialog_no), (DialogInterface.OnClickListener) null);
    try {
        alertDialog.show();
    } catch (Exception e) {
        Log.e(THIS_FILE, "error while trying to show deletion yes/no dialog");
    }
}

From source file:com.jwork.dhammapada.MainActivity.java

private void showCrashDialog() {
    final CrashHandler handler = CrashHandler.getInstance();
    final AlertDialog ad = new AlertDialog.Builder(this).create();
    ad.setTitle("Error Report");
    ad.setMessage("An error was detected. Reporting it will support faster bug fixing.");
    ad.setButton(AlertDialog.BUTTON_POSITIVE, "Report it", new DialogInterface.OnClickListener() {

        @Override/*  www  . j  a v a  2  s. c  o m*/
        public void onClick(DialogInterface dialog, int which) {
            handler.clearCrashFlag();
            ad.dismiss();
            MainActivity.this.finish();
            handler.sendEmail(MainActivity.this);
            //            MainActivity.this.startActivity(new Intent(MainActivity.this, MainActivity.class));
        }
    });
    ad.setButton(AlertDialog.BUTTON_NEGATIVE, "Not now", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            handler.clearCrashFlag();
            ad.dismiss();
            MainActivity.this.finish();
            MainActivity.this.startActivity(new Intent(MainActivity.this, MainActivity.class));
        }
    });
    ad.show();
}

From source file:com.paranoid.lukemovement.halolauncher.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    try {/*from  ww  w  .j  a  v  a 2  s. com*/
    } catch (Exception e) {
        AlertDialog alertDialog = new AlertDialog.Builder(this).create();
        alertDialog.setTitle("Error");
        alertDialog.setMessage(
                "This app will not work on your device because your rom does not support HALO\n\nPlease install a rom that does support this feature(e.g. 'Paranoid Android')");
        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
    }

    SP = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE);

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}

From source file:com.aikidonord.fragments.FragmentDate.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_date, null /*container, false*/);

    View rlLoading = view.findViewById(R.id.loadingPanel);
    //View listView = view.getListView();

    if (VerifConnexion.isOnline(this.getActivity())) {
        rlLoading.setVisibility(View.VISIBLE);

        // on va fair l'impasse l dessus vu que je ne suis pas bien sr
        // de la manire dont il faut oprer tant que la vue n'a pas t renvoye.
        //listView.setVisibility(View.GONE);
        this.lancementAsync();
    } else {//from   w  w  w.j a  v  a 2s  .  co m

        AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create();
        alertDialog.setTitle(getResources().getString(R.string.app_name));
        alertDialog.setMessage(getResources().getString(R.string.no_network));
        alertDialog.setIcon(R.drawable.ic_launcher);
        alertDialog.setCancelable(false);
        alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // if this button is clicked, close
                        // current activity
                        FragmentDate.this.getActivity().finish();
                    }
                });
        alertDialog.show();
    }

    return view;
}

From source file:com.aikidonord.fragments.FragmentLieu.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_lieu, null /*container, false*/);

    View rlLoading = view.findViewById(R.id.loadingPanel);
    //View listView = view.getListView();

    if (VerifConnexion.isOnline(this.getActivity())) {
        rlLoading.setVisibility(View.VISIBLE);

        // on va fair l'impasse l dessus vu que je ne suis pas bien sr
        // de la manire dont il faut oprer tant que la vue n'a pas t renvoye.
        //listView.setVisibility(View.GONE);
        this.lancementAsync();
    } else {//from  w  w  w. j a v a  2 s.c  o  m

        AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create();
        alertDialog.setTitle(getResources().getString(R.string.app_name));
        alertDialog.setMessage(getResources().getString(R.string.no_network));
        alertDialog.setIcon(R.drawable.ic_launcher);
        alertDialog.setCancelable(false);
        alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // if this button is clicked, close
                        // current activity
                        FragmentLieu.this.getActivity().finish();
                    }
                });
        alertDialog.show();
    }

    return view;
}