示例#1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.more_info) {
      DialogFragment newFragment = AlertDialogFragment.newInstance();
      newFragment.show(getFragmentManager(), "dialog");
    }

    return super.onOptionsItemSelected(item);
  }
示例#2
0
 public void showDialog(String title, String message) {
   DialogFragment newFragment = AlertDialogFragment.newInstance(title, message);
   newFragment.show(getSupportFragmentManager(), "dialog.alert");
 }
示例#3
0
 void showDialog() {
   DialogFragment newFragment = AlertDialogFragment.newInstance("alert_dialog", null);
   newFragment.show(getFragmentManager(), "dialog");
 }