Example usage for android.app Dialog findViewById

List of usage examples for android.app Dialog findViewById

Introduction

In this page you can find the example usage for android.app Dialog 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.sawyer.advadapters.app.dialogs.AddJSONArrayDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setContentView(R.layout.dialog_add_jsonarray);
    dialog.setTitle(R.string.title_dialog_add_movies);

    Button btn = (Button) dialog.findViewById(R.id.movie_single_btn);
    btn.setOnClickListener(new OnAddSingleClickListener());
    TextView tv = (TextView) dialog.findViewById(R.id.movie_single_txt);
    tv.setText("- " + mMovieItems.optJSONObject(0).optString(MovieItem.JSON_TITLE));

    btn = (Button) dialog.findViewById(R.id.movies_jsonarray_btn);
    btn.setOnClickListener(new OnAddJSONArrayClickListener());
    tv = (TextView) dialog.findViewById(R.id.movie_multi_txt1);
    tv.setText("- " + mMovieItems.optJSONObject(1).optString(MovieItem.JSON_TITLE));
    tv = (TextView) dialog.findViewById(R.id.movie_multi_txt2);
    tv.setText("- " + mMovieItems.optJSONObject(2).optString(MovieItem.JSON_TITLE));

    btn = (Button) dialog.findViewById(R.id.movies_vararg_btn);
    btn.setOnClickListener(new OnAddVarargsClickListener());
    btn.setVisibility(mIsArgvargsEnabled ? View.VISIBLE : View.GONE);
    return dialog;
}

From source file:com.flowzr.activity.DateFilterActivity.java

private void setDialogResult(Dialog d, Calendar c) {
    DatePicker dp = (DatePicker) d.findViewById(R.id.date);
    c.set(Calendar.YEAR, dp.getYear());
    c.set(Calendar.MONTH, dp.getMonth());
    c.set(Calendar.DAY_OF_MONTH, dp.getDayOfMonth());
    TimePicker tp = (TimePicker) d.findViewById(R.id.time);
    c.set(Calendar.HOUR_OF_DAY, tp.getCurrentHour());
    c.set(Calendar.MINUTE, tp.getCurrentMinute());
    updateDate();/* w  w w  . java2  s.  c  o m*/
}

From source file:com.digitallizard.nicecompass.CompassActivity.java

private Dialog createSelectBearingDialog() {
    Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.bearing_dialog);

    EditText bearingText = (EditText) dialog.findViewById(R.id.bearingSelectionText);
    bearingText.setText(""); // set the initial text
    bearingText.requestFocus(); // get the focus

    return dialog;
}

From source file:com.example.energospolitis.ReportListActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
    case 1:/*from   w  w w .  ja v  a2  s . co m*/
        final Dialog dialog = new Dialog(ReportListActivity.this);
        dialog.setContentView(R.layout.customdialog);
        dialog.setTitle("");

        Button recent = (Button) dialog.findViewById(R.id.recbtn);
        recent.setText("");
        Button type = (Button) dialog.findViewById(R.id.typebtn);
        type.setText("");
        Button rate = (Button) dialog.findViewById(R.id.ratebtn);
        rate.setText("");

        recent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ReportList.sort("recent");
                restart();
                dialog.dismiss();
            }
        });
        rate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ReportList.sort("rate");
                restart();
                dialog.dismiss();
            }

        });
        type.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ReportList.sort("type");
                dialog.dismiss();
            }
        });

        dialog.show();
        break;
    default:
        return super.onOptionsItemSelected(item);
    }

    return true;
}

From source file:com.flowzr.activity.DateFilterActivity.java

private void prepareDialog(Dialog dialog, Calendar c) {
    DatePicker dp = (DatePicker) dialog.findViewById(R.id.date);
    dp.init(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), null);
    TimePicker tp = (TimePicker) dialog.findViewById(R.id.time);
    tp.setIs24HourView(is24HourFormat(this));
    tp.setCurrentHour(c.get(Calendar.HOUR_OF_DAY));
    tp.setCurrentMinute(c.get(Calendar.MINUTE));
}

From source file:com.zpwebsites.linuxonandroid.Install_Fedora_2.java

private void downloads(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.download_fedora_menu);
    dialog.setCancelable(true);//from ww  w . j av  a2s.com

    Button btn_DownloadLarge = (Button) dialog.findViewById(R.id.btn_DownloadLarge);
    btn_DownloadLarge.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) {
                downloadImage(v.getContext(), CFG.torrentURL_Fedora_Large_ext4, CFG.imageURL_Fedora_Large_ext4);
            } else {
                downloadImage(v.getContext(), CFG.torrentURL_Fedora_Large_ext2, CFG.imageURL_Fedora_Large_ext2);
            }
            dialog.dismiss();
        }
    });

    dialog.show();
}

From source file:com.qjdchina.qjdsale.MemberPicturePlusFragment.java

private void clickProcess(View view, String folder, String file) {
    if (view.getTag().equals(0)) {
        startCamera(folder, file);//from   w w w .  j  a  v  a  2s.  c  o m
    } else {

        Dialog dialog = new MemberPictureDialog(getActivity(), R.style.dialog_center);
        dialog.show();
        ImageView iv = (ImageView) dialog.findViewById(R.id.iv_dialog_member);
        ProgressBar pb = (ProgressBar) dialog.findViewById(R.id.pb_dialog_member);
        Bitmap bp = getImage(folder + file, 1024);
        iv.setImageBitmap(bp);
        pb.setVisibility(View.INVISIBLE);

        Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT).show();
    }
}

From source file:com.example.nestedarchetypeactivityexample.InnerArchetypeViewerActivity.java

/**
  * Show info dialog.//from w w w.j  a v a  2 s .  co m
  *
  * @param content the content
  */
private void showInfoDialog(String content) {
    final Dialog dialog = new Dialog(this);
    dialog.setTitle("Json Adl Structure");
    dialog.setContentView(R.layout.custom_dialog);
    TextView dialogText = (TextView) dialog.findViewById(R.id.dialogText);
    dialogText.setMovementMethod(new ScrollingMovementMethod());
    dialogText.setText(content);

    Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
    dialogButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            dialog.dismiss();

        }
    });

    dialog.show();
}

From source file:com.osama.cgpacalculator.MainActivity.java

@SuppressLint("InflateParams")
private void showAboutDialog() {
    final ScaleAnimation animation = new ScaleAnimation(0f, 1f, 0f, 1f);
    animation.setDuration(800);/*from   w w w .  ja  v  a  2 s . co m*/

    Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.about_dialog);

    final FrameLayout frame = ((FrameLayout) dialog.findViewById(R.id.about_content_layout));
    frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));

    dialog.findViewById(R.id.credit_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            frame.removeAllViews();
            isShowingLi = false;
            if (!isShowingCr) {
                frame.addView(getLayoutInflater().inflate(R.layout.credits_layout, null));
                isShowingCr = true;
                frame.setAnimation(animation);
            } else {
                frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));
                isShowingCr = false;
                frame.setAnimation(animation);
            }
            frame.animate();
        }
    });

    dialog.findViewById(R.id.license_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            frame.removeAllViews();
            isShowingCr = false;
            if (!isShowingLi) {
                frame.addView(getLayoutInflater().inflate(R.layout.license_layout, null));
                isShowingLi = true;
                frame.setAnimation(animation);
            } else {
                frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));
                isShowingLi = false;
                frame.setAnimation(animation);
            }
            frame.animate();
        }
    });

    dialog.show();
}

From source file:com.zpwebsites.linuxonandroid.opensource.Install_Ubuntu10_2.java

private void downloads(Context context) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.download_ubuntu10_menu);
    dialog.setCancelable(true);//from   ww  w. j a  v a2  s . c om

    Button btn_DownloadLarge = (Button) dialog.findViewById(R.id.btn_DownloadLarge);
    btn_DownloadLarge.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            downloadImage(v.getContext(), CFG.torrentURL_Ubuntu10_Large, CFG.imageURL_Ubuntu10_Large);
            dialog.dismiss();
        }
    });

    Button btn_DownloadSmall = (Button) dialog.findViewById(R.id.btn_DownloadSmall);
    btn_DownloadSmall.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            downloadImage(v.getContext(), CFG.torrentURL_Ubuntu10_Small, CFG.imageURL_Ubuntu10_Small);
            dialog.dismiss();
        }
    });
    dialog.show();

}