@Override protected void onPostExecute(String result) { super.onPostExecute(result); Button follow_btn = (Button) profileView.findViewById(R.id.follow_btn); if (resulting == null) { Dialog d = new Dialog(activity); d.setTitle("Something Wrong...Check Internet Connection "); d.show(); } else { follow_btn.setText("follow"); follow_btn.setBackgroundResource(R.drawable.abc_tab_unselected_pressed_holo); follow_btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { new FollowButton(coachIndex, profileView, activity).execute(); } }); Dialog d = new Dialog(activity); d.setTitle("unfollowed"); d.show(); } } // end post ex
@Override public void onClick(View arg0) { // TODO Auto-generated method stub if (etLectNum.getText().toString().length() == 0) { Dialog d = new Dialog(this); d.setTitle("Lecture Number cannot be empty!"); d.show(); } else { lecture_number = Integer.parseInt(etLectNum.getText().toString()); lecture_title = etLectTitle.getText().toString(); lecture_description = etLectDescription.getText().toString(); dbh = new DBHelper(this); if (getIntent().getExtras().getBoolean("Update")) { dbh.updateLecture( semSelected, courseSelected, lecture_number, lecture_title, lecture_description, ""); Toast.makeText( getApplicationContext(), "Lecture " + lecture_number + " updated successfully!", Toast.LENGTH_SHORT) .show(); Intent intent = new Intent(getApplicationContext(), com.aakash.studentmanager.LectureList.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else { Cursor rs = dbh.getLectureData(semSelected, courseSelected, lecture_number); rs.moveToFirst(); if (rs.isAfterLast() == true) { dbh.insertLecture( semSelected, courseSelected, lecture_number, lecture_title, lecture_description, ""); Toast.makeText( getApplicationContext(), "Lecture " + lecture_number + " added successfully!", Toast.LENGTH_SHORT) .show(); Intent intent = new Intent(getApplicationContext(), com.aakash.studentmanager.LectureList.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } else { Dialog d = new Dialog(this); d.setTitle("Duplicate Entry:"); TextView tv = new TextView(this); tv.setText("Lecture Number " + lecture_number + " already added!"); d.setContentView(tv); d.show(); } } dbh.close(); } }
public void showUpdateDialog() { final Dialog dialog = new Dialog(getActivity()); dialog.setContentView(R.layout.edit_user_info); dialog.setCancelable(true); updateProfileTV = (TextView) dialog.findViewById(R.id.udpateProfileTV); phoneNumberUpd = (TextView) dialog.findViewById(R.id.phoneNumberUpd); errorTxtUpt = (TextView) dialog.findViewById(R.id.errorTxtUpt); nameUpd = (EditText) dialog.findViewById(R.id.nameUpd); eMailUpd = (EditText) dialog.findViewById(R.id.eMailUpd); addressETUpd = (EditText) dialog.findViewById(R.id.addressETUpd); save = (Button) dialog.findViewById(R.id.saveUpt); phoneNumberUpd.setText(databaseHandler.getUser(1).getMsisdn()); nameUpd.setText(databaseHandler.getUser(1).getName()); eMailUpd.setText(databaseHandler.getUser(1).getEmail()); addressETUpd.setText(databaseHandler.getRegister(1).getAddress()); save.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Hit here to update if (carFunctions.isConnectingToInternet()) { new UpdateProfile( databaseHandler.getUser(1).getMsisdn(), eMailUpd.getText().toString(), nameUpd.getText().toString(), addressETUpd.getText().toString()) .execute(); // getActivity().finish(); // Intent intent = new Intent(getActivity(), getActivity() // .getClass()); // intent.putExtra("fragNum", "0"); // getActivity().startActivity(intent); } else { Toast.makeText(getActivity(), "Check your internet connection", Toast.LENGTH_LONG) .show(); } dialog.dismiss(); } }); if (setting.getDuration() == 1) { dialog.setTitle(getResources().getString(R.string.update_profile_ar)); updateProfileTV.setText(getResources().getString(R.string.update_profile_ar)); save.setText(getResources().getString(R.string.save_ar)); } else { dialog.setTitle(getResources().getString(R.string.update_profile_en)); updateProfileTV.setText(getResources().getString(R.string.update_profile_en)); } dialog.show(); }
private void showSayhiDialog() { if (null == sayhiDialog) { sayhiView = LayoutInflater.from(mContext).inflate(R.layout.dialog_sayhi, null); final EditText etContent = (EditText) sayhiView.findViewById(R.id.et_sayhi); etContent.setText("看了你的资料,我发现你应该就是我一直在寻找的那个人,能认识吗? 期待你的回复!"); sayhiDialog = new Dialog(mContext); sayhiDialog.setTitle("向 " + mCurrentSayhiUser.getNickname() + " 打招呼"); sayhiView .findViewById(R.id.tv_send_sayhi) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (TextUtils.isEmpty(etContent.getText())) { ToastFactory.getToast(mContext, "内容不能为空").show(); return; } sendSayhi(etContent.getText().toString()); sayhiDialog.dismiss(); } }); sayhiView .findViewById(R.id.tv_cancel_send_sayhi) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { sayhiDialog.dismiss(); } }); sayhiDialog.show(); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); sayhiDialog.addContentView(sayhiView, params); } if (!sayhiDialog.isShowing()) { sayhiDialog.setTitle("向 " + mCurrentSayhiUser.getNickname() + " 打招呼"); sayhiDialog.show(); } }
private void myTitleDialog() { final Dialog setTitle = new Dialog(this); setTitle.setContentView(R.layout.titlesetter); setTitle.setTitle("Set Title Text"); db.open(); Cursor V = db.getRecord("title", 1); String title = V.getString(1); db.close(); final EditText newTitle = (EditText) setTitle.findViewById(R.id.setNewTitle); newTitle.setText(title); newTitle.requestFocus(); setTitle.show(); Button submitTitle = (Button) setTitle.findViewById(R.id.button2); submitTitle.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { String input = newTitle.getText().toString(); Log.i("titleTest", "-->" + input); try { db.open(); db.updateTitle(1, input); } catch (SQLException sqle) { throw sqle; } db.close(); vgp1.updateMain(); // mview.updateAll(); setTitle.dismiss(); } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mpref = this.getSharedPreferences("mypref", 0); handler = new Handler(); bargeStatus = new ArrayList<String>(); bargeNames = new ArrayList<String>(); bargeTimes = new ArrayList<String>(); latList = new ArrayList<Integer>(); lonList = new ArrayList<Integer>(); toBargeMap = new Intent(BargeList.this, BargeMap.class); bargeList = getListView(); bargeList.setClickable(true); bargeList.setItemsCanFocus(false); helpcolor = new Dialog(BargeList.this); helpcolor.setContentView(R.layout.helpcolor); helpcolor.setTitle("Help"); Button helpok = (Button) helpcolor.findViewById(R.id.helpok); helpok.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { helpcolor.dismiss(); } }); }
private void showFromDialog() { final Dialog dialog = new Dialog(getActivity()); dialog.getWindow().setWindowAnimations(R.style.PauseDialogAnimation); dialog.setTitle(R.string.time_dialog_from); dialog.setCanceledOnTouchOutside(false); dialog.setContentView(R.layout.dialog_time_layout); Button okButton = (Button) dialog.findViewById(R.id.dialogTimeOkButton); Button cancelButton = (Button) dialog.findViewById(R.id.dialogTimeCancelButton); final TimePicker timePicker = (TimePicker) dialog.findViewById(R.id.timePicker); okButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR, timePicker.getCurrentHour()); calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute()); profile.setFromTime(calendar.getTimeInMillis()); dialog.dismiss(); showToDialog(); } }); cancelButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
@Override public void onBackPressed() { if (fragmentStack.size() > 1) { fragmentCount.pop(); fragmentStack.pop().onPause(); setItemCheck(fragmentCount.lastElement()); Fragment fragment = fragmentStack.lastElement(); fragmentManager.beginTransaction().replace(R.id.container, fragment).commit(); } else { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_exit); dialog.setTitle("Exit app ?"); Button button_exit = (Button) dialog.findViewById(R.id.button_exit); Button button_cancel = (Button) dialog.findViewById(R.id.button_cancle); dialog.show(); button_exit.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); finish(); } }); button_cancel.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); } }
@Override public Dialog onCreateDialog(int i) { WPEntry entry = entries.get(i); Dialog dialog = new Dialog(this); // dialog.setOwnerActivity(this); dialog.setContentView(R.layout.entry_dialog); dialog.setTitle(entry.getSportInt()); TextView dateView = (TextView) dialog.findViewById(R.id.date); dateView.setText(entry.date.toString()); // TODO: Formatieren TextView durationView = (TextView) dialog.findViewById(R.id.duration); durationView.setText("Dauer: " + entry.duration + " min"); TextView pointsView = (TextView) dialog.findViewById(R.id.points); pointsView.setText(entry.getPoints() + " Punkte"); TextView notesView = (TextView) dialog.findViewById(R.id.notes); notesView.setText(entry.notes); return dialog; }
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.setTitle(R.string.add_header); return dialog; }
/** * Called when the user clicks on one of the icons in the map. It uses a Toast to say hello. * * @param pIndex is the Find's index in the ArrayList */ @Override protected boolean onTap(int pIndex) { Dialog dialog = new Dialog(mContext); dialog.setCanceledOnTouchOutside(true); OverlayItem item = mOverlays.get(pIndex); dialog.setContentView(R.layout.custom_dialog); dialog.setTitle(item.getTitle()); TextView text = (TextView) dialog.findViewById(R.id.text); text.setText(item.getSnippet()); ImageView image = (ImageView) dialog.findViewById(R.id.image); image.setImageResource(R.drawable.small_letter); dialog.show(); // Get contact StringTokenizer st = new StringTokenizer(item.getTitle(), " , "); String temp = st.nextToken(); final String contact = st.nextToken(); final Button button = (Button) dialog.findViewById(R.id.more_info_button); button.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent(); myIntent.setClassName("edu.stanford.jdiprete", "edu.stanford.jdiprete.DialogOnclick"); myIntent.putExtra("contact", contact); myIntent.putExtra("captureId", captureId); mContext.startActivity(myIntent); } }); return true; }
public void open(View view) { final Dialog dialog = new Dialog(NewTask.this); dialog.setContentView(R.layout.activity_calendar2); dialog.setTitle("Select Date"); calendar = (CalendarView) dialog.findViewById(R.id.calendar); calendar.setOnDateChangeListener( new CalendarView.OnDateChangeListener() { @Override public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) { Year = year; Month = month; Day = dayOfMonth; date1 = new Date(Year - 1900, Month, Day); DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext()); DATE.setText(dateFormat.format(date1), TextView.BufferType.EDITABLE); Toast.makeText( getApplicationContext(), dayOfMonth + "/" + (Month + 1) + "/" + year, Toast.LENGTH_LONG) .show(); dialog.dismiss(); } }); dialog.show(); }
private void customDialoguGoster() { final Dialog dialog = new Dialog(CustomDialogActivity.this); dialog.setContentView(R.layout.custom_dialog_layout); dialog.setTitle("Title"); dialog.setCancelable(false); final TextView tvCustomTextView = (TextView) dialog.findViewById(R.id.tvCustomTextView); tvCustomTextView.setText("Selam Gençler Keyifler Nasıl?"); final Button bOkey = (Button) dialog.findViewById(R.id.bOkey); Button bCancel = (Button) dialog.findViewById(R.id.bCancel); bOkey.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { tvCustomTextView.setText("Demek ki okeymiş"); } }); bCancel.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
private void tryToAccessiblyDeleteBook(final Book book) { final ZLResource dialogResource = ZLResource.resource("dialog"); final ZLResource boxResource = dialogResource.getResource("deleteBookBox"); final Dialog confirmDialog = new Dialog(myActivity); confirmDialog.setTitle(getResources().getString(R.string.accessible_alert_title)); confirmDialog.setContentView(R.layout.accessible_alert_dialog); TextView confirmation = (TextView) confirmDialog.findViewById(R.id.bookshare_confirmation_message); confirmation.setText(boxResource.getResource("message").getValue()); Button yesButton = (Button) confirmDialog.findViewById(R.id.bookshare_dialog_btn_yes); Button noButton = (Button) confirmDialog.findViewById(R.id.bookshare_dialog_btn_no); yesButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { deleteBook(book, Library.REMOVE_FROM_DISK); confirmDialog.dismiss(); } }); noButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { confirmDialog.dismiss(); } }); confirmDialog.show(); }
public void DialogExercicios(Exercicios exercicio) { dialog = new Dialog(context, R.style.tema_dialogo); dialog.setTitle("Detalhes"); dialog.setContentView(R.layout.dialog_exercicio); TextView dia = (TextView) dialog.findViewById(R.id.exe_det_dia); TextView hora = (TextView) dialog.findViewById(R.id.exe_det_hora); TextView desc = (TextView) dialog.findViewById(R.id.exe_det_desc); TextView duracao = (TextView) dialog.findViewById(R.id.exe_det_duracao); TextView tipo = (TextView) dialog.findViewById(R.id.exe_det_tipo); TextView intensidade = (TextView) dialog.findViewById(R.id.exe_det_intensidade); Button ok = (Button) dialog.findViewById(R.id.exe_b_ok); dia.setText( format_dia.format(exercicio.getData().getTime()) + "\n" + exercicio .getData() .getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault())); hora.setText(format_hora.format(exercicio.getData().getTime())); desc.setText(exercicio.getDescricao()); duracao.setText(exercicio.getDuracao() + " minutos"); tipo.setText(exercicio.getTipo()); // intensidade.setText(ExerciciosIntensidade.getNome(context, // exercicio.getIntensidade().getCod())); intensidade.setText(exercicio.getIntensidade()); ok.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
@Override protected Dialog onCreateDialog(int id) { // Reason Dialog. Context mContext = getParent(); final Dialog dialog = new Dialog(mContext); dialog.setContentView(R.layout.reasondialog); dialog.setTitle("Answer Reason"); Dia_ReasonHeaderBox = (TextView) dialog.findViewById(R.id.ReasonHeaderBox); Button ReasonCancel = (Button) dialog.findViewById(R.id.ReasonCancel); ReasonCancel.setOnClickListener( new OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); if (CorrectAnswerReasonInHTML != null && CorrectAnswerReasonInHTML.length() > 0) { Dia_ReasonHeaderBox.setText(Html.fromHtml(CorrectAnswerReasonInHTML)); } else { Dia_ReasonHeaderBox.setText(Html.fromHtml("No reason entered on system")); } return dialog; }
public static void showRateDialog(final Context mContext) { final Dialog dialog = new Dialog(mContext); dialog.setTitle("Rate " + APP_TITLE); LinearLayout ll = new LinearLayout(mContext); ll.setOrientation(LinearLayout.VERTICAL); TextView tv = new TextView(mContext); tv.setText( "If you enjoy using " + APP_TITLE + ", please take a moment to rate it. Thanks for your support!"); tv.setWidth(240); tv.setPadding(4, 0, 4, 10); ll.addView(tv); Button b1 = new Button(mContext); b1.setText("Rate " + APP_TITLE); b1.setOnClickListener( new OnClickListener() { public void onClick(View v) { mContext.startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME))); dialog.dismiss(); } }); ll.addView(b1); dialog.setContentView(ll); dialog.show(); }
@Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); String selection = l.getItemAtPosition(position).toString(); selection = selection.replaceAll(" ", "_"); dialog = new Dialog(SubExercise.this); dialog.setContentView(R.layout.instructions); dialog.setTitle("Exercise Instructions"); dialog.setCancelable(true); Button close = (Button) dialog.findViewById(R.id.btnInstrCancel); TextView instr = (TextView) dialog.findViewById(R.id.lblReturnInstr); close.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); int res_id = getResources().getIdentifier(selection, "string", this.getPackageName()); if (res_id != 0) { String instructions = getResources().getString(res_id); instr.setText(instructions); } else { instr.setText("Instructions Coming Soon!"); } dialog.show(); }
/** @brief ページ読み込み進行ハンドラ 100% に達したらページ修正、オートログインなどを実施する */ @Override public void onProgressChanged(WebView wv, int progress) { Log.d(TAG, "onProgressChanged = " + progress + " " + wv.getUrl()); if (progress < 100) { if (dlg == null) { dlg = new Dialog(view.getContext()); dlg.setTitle("Loading..."); dlg.show(); } } else { if (dlg != null) { dlg.dismiss(); dlg = null; } if (autoLogin(wv)) { return; } String url = wv.getUrl(); if (url != null && url.startsWith(INNER_URL_PREFIX)) { fixPage(wv); } } }
private void show(final String stdUser) { final Dialog d = new Dialog(ViewEnrolledStdUpdateScoreActivity.this); d.setTitle("NumberPicker"); d.setContentView(R.layout.layout_number_picker); Button b1 = (Button) d.findViewById(R.id.button1); Button b2 = (Button) d.findViewById(R.id.button2); final NumberPicker np = (NumberPicker) d.findViewById(R.id.numberPicker1); np.setMaxValue(100); // max value 100 np.setMinValue(0); // min value 0 np.setWrapSelectorWheel(false); b1.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { updateScore(stdUser, np.getValue()); d.dismiss(); } }); b2.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { d.dismiss(); // dismiss the dialog } }); d.show(); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); loginStatus = (TextView) findViewById(R.id.loginStatus); if (!prefs.getString("userKey", "").equals("")) { loginStatus.setText("Login as: " + prefs.getString("username", "")); } else { loginStatus.setText("Not logged in"); } dialogHelp = new Dialog(this); dialogHelp.setTitle("Help"); dialogHelp.setContentView(R.layout.help); list = (ListView) findViewById(R.id.ListViewMain); List<Adapter> listOfPhonebook = new ArrayList<Adapter>(); listOfPhonebook.add(new Adapter("Start Test", R.drawable.yellow_ic_menu_forward)); MenuAdapter adapter = new MenuAdapter(this, listOfPhonebook); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setAdapter(adapter); list.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { startActivity(new Intent(Main.this, MultipleAnswerBullet.class)); finish(); } }); }
public CDcass(Activity activity) { this.activity = activity; dialoggen = new Dialog(activity); dialoggen.setContentView(R.layout.dlgcass); det1 = (EditText) dialoggen.findViewById(R.id.etcasssum); det2 = (EditText) dialoggen.findViewById(R.id.etcassfam); dbutton = (Button) dialoggen.findViewById(R.id.bcassok); dbutcncl = (Button) dialoggen.findViewById(R.id.bcasscnclc); dbutton.setOnClickListener(this); dbutcncl.setOnClickListener(this); dbutton.setText("Отправить"); dbutcncl.setText("Отмена"); String title = null; if (CDgencass.DC == DataCass.TypeEvent.inkasator) title = MainActivity.mainstrings.DataCass.get(0); if (CDgencass.DC == DataCass.TypeEvent.promoter) title = MainActivity.mainstrings.DataCass.get(1); if (CDgencass.DC == DataCass.TypeEvent.cass) title = MainActivity.mainstrings.DataCass.get(2); dialoggen.setTitle(title); dialoggen.show(); if (!title.equals(MainActivity.mainstrings.DataCass.get(0))) { det2.setVisibility(View.GONE); ((TextView) dialoggen.findViewById(R.id.tvcassfam)).setVisibility(View.GONE); } }
/** [Give the description for method]. */ public void showDialog() { mDialog = new Dialog(context); mDialog.setTitle(""); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setContentView(R.layout.dialog_gps); mDialog.setCancelable(true); LinearLayout chat = (LinearLayout) mDialog.findViewById(R.id.line_dialog_gps_chat); LinearLayout info = (LinearLayout) mDialog.findViewById(R.id.line_dialog_gps_info); chat.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(context, ChatActivity.class); context.startActivity(i); } }); info.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(context, ChatActivity.class); context.startActivity(i); } }); mDialog.show(); }
private void comfirmUserCurrentPassword() { final Dialog comfirmUserPw = new Dialog(Modify_userData.this); comfirmUserPw.setTitle(getResources().getString(R.string.Register_phoneShortButton)); comfirmUserPw.setContentView(R.layout.modify_enterpw); final EditText edt_pw = (EditText) comfirmUserPw.findViewById(R.id.modify_pwComfirm); Button btn_okay = (Button) comfirmUserPw.findViewById(R.id.modify_okay); Button btn_cancel = (Button) comfirmUserPw.findViewById(R.id.modify_cancel); btn_okay.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { String pw_temp = edt_pw.getText().toString(); UpdateUserData updateUserData = new UpdateUserData(page); updateUserData.execute(pw_temp); comfirmUserPw.dismiss(); } }); btn_cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { comfirmUserPw.dismiss(); } }); comfirmUserPw.show(); }
public void onClickImg(View v) { // open popupwindow here final Dialog myDialog = new Dialog(this); myDialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); View view = LayoutInflater.from(this).inflate(R.layout.popup, null); final RadioGroup radio = (RadioGroup) view.findViewById(R.id.radioGroup1); final RadioButton r1 = (RadioButton) view.findViewById(R.id.radio0); final RadioButton r2 = (RadioButton) view.findViewById(R.id.radio1); final RadioButton r3 = (RadioButton) view.findViewById(R.id.radio2); Button exit = (Button) view.findViewById(R.id.button1); exit.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { int selectedID = radio.getCheckedRadioButtonId(); if (selectedID == r1.getId()) sortBy = "relevance"; if (selectedID == r2.getId()) sortBy = "ranking"; if (selectedID == r3.getId()) sortBy = "recent"; myDialog.dismiss(); } }); myDialog.setContentView(view); myDialog.setTitle("settings"); myDialog.show(); myDialog.getWindow().setLayout(580, 540); // Controlling width and // height. }
/** Show find dialog. Very pretty UI code ;) */ public void showFindDialog() { Log.d(TAG, "find dialog..."); final Dialog dialog = new Dialog(this); dialog.setTitle(R.string.find_dialog_title); LinearLayout contents = new LinearLayout(this); contents.setOrientation(LinearLayout.VERTICAL); this.findTextInputField = new EditText(this); this.findTextInputField.setWidth(this.pagesView.getWidth() * 80 / 100); Button goButton = new Button(this); goButton.setText(R.string.find_go_button); goButton.setOnClickListener( new OnClickListener() { public void onClick(View v) { String text = OpenFileActivity.this.findTextInputField.getText().toString(); OpenFileActivity.this.findText(text); dialog.dismiss(); } }); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.leftMargin = 5; params.rightMargin = 5; params.bottomMargin = 2; params.topMargin = 2; contents.addView(findTextInputField, params); contents.addView(goButton, params); dialog.setContentView(contents); dialog.show(); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.color_button: colorDialog = new Dialog(this); colorDialog.setTitle(getString(R.string.select_color)); colorDialog.setContentView(R.layout.color_dialog); colorDialog.findViewById(R.id.green_color_button).setOnClickListener(this); colorDialog.findViewById(R.id.yellow_color_button).setOnClickListener(this); colorDialog.findViewById(R.id.red_color_button).setOnClickListener(this); colorDialog.show(); break; case R.id.green_color_button: currentColor = MainMenuActivity.COLOR_GREEN; ((ImageButton) findViewById(R.id.color_button)) .setImageDrawable(getResources().getDrawable(R.drawable.greenstar)); colorDialog.dismiss(); break; case R.id.yellow_color_button: currentColor = MainMenuActivity.COLOR_YELLOW; ((ImageButton) findViewById(R.id.color_button)) .setImageDrawable(getResources().getDrawable(R.drawable.yellowstar)); colorDialog.dismiss(); break; case R.id.red_color_button: currentColor = MainMenuActivity.COLOR_RED; ((ImageButton) findViewById(R.id.color_button)) .setImageDrawable(getResources().getDrawable(R.drawable.redstar)); colorDialog.dismiss(); break; default: break; } }
// NewItemDialogFragment is called by the AddNewFragment Fragment @Nullable @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View theView = inflater.inflate(R.layout.fragment_change_item_dialog, container, false); View saveItemChangesBtn = theView.findViewById(R.id.saveItemChangesBtn); saveItemChangesBtn.setOnClickListener(this); saveItemChangesBtn.hasFocus(); View cancelItemChangesBtn = theView.findViewById(R.id.cancelItemChangesBtn); cancelItemChangesBtn.setOnClickListener(this); View deleteItemBtn = theView.findViewById(R.id.deleteItemBtn); deleteItemBtn.setOnClickListener(this); args = getArguments(); editItemTextField = (EditText) theView.findViewById(R.id.editItemText); editItemTextField.setText(args.getString("EditItemText")); // setup the dialog Dialog dialog = getDialog(); dialog.setTitle("Edit " + args.getString("EditItemType")); dialog.setCanceledOnTouchOutside(false); return theView; }
private void showDialogToOpenAccountSettings(String msg, final Intent intent) { if (connectionNotConfiguredProperlyDialog.isShowing()) { return; } connectionNotConfiguredProperlyDialog.setContentView(R.layout.settings_dialog); connectionNotConfiguredProperlyDialog.setTitle(getString(R.string.configuration)); TextView label = (TextView) connectionNotConfiguredProperlyDialog.findViewById(R.id.text); label.setText(msg); Button continueButton = (Button) connectionNotConfiguredProperlyDialog.findViewById(R.id.continueButton); continueButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { connectionNotConfiguredProperlyDialog.dismiss(); startActivity(intent); } }); Button ignoreButton = (Button) connectionNotConfiguredProperlyDialog.findViewById(R.id.ignoreButton); ignoreButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { connectionNotConfiguredProperlyDialog.dismiss(); } }); connectionNotConfiguredProperlyDialog.show(); }
/*년도 최대값을 올해로 설정하게, 캘린더로 현재 연도 가져오기.*/ public void birthDialog() { final Dialog d = new Dialog(BabyAddActivity.this); d.setTitle("생년월일"); d.setContentView(R.layout.dialog_baby_add_birth); // 아마도 가로세로 크기 지정??????????????????????????????????? // d.getWindow().setLayout(디멘으로 값지정); final NumberPicker npY, npM, npD; npY = (NumberPicker) d.findViewById(R.id.numberPickerY); npY.setMaxValue(2015); npY.setMinValue(1900); npY.setValue(2000); npY.setWrapSelectorWheel(false); npM = (NumberPicker) d.findViewById(R.id.numberPickerM); npM.setMaxValue(12); npM.setMinValue(1); npM.setWrapSelectorWheel(false); npD = (NumberPicker) d.findViewById(R.id.numberPickerD); npD.setMaxValue(31); npD.setMinValue(1); npD.setWrapSelectorWheel(false); Button btn_ok; btn_ok = (Button) d.findViewById(R.id.btn_birth_ok); btn_ok.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // 한자리수 월 일 앞에 0 붙이기 StringBuilder sb = new StringBuilder(); String Y, M, D; Y = npY.getValue() + ""; M = npM.getValue() + ""; D = npD.getValue() + ""; if (String.valueOf(npM.getValue()).length() == 1) { M = "0" + npM.getValue(); } if (String.valueOf(npD.getValue()).length() == 1) { D = "0" + npD.getValue(); } sb.append(Y); sb.append(M); sb.append(D); babyBirth_num = sb.toString(); // 서버로 보내는 값 babyBirth.setText( String.valueOf(npY.getValue()) + " / " + String.valueOf(npM.getValue()) + " / " + String.valueOf(npD.getValue())); d.dismiss(); } }); d.show(); }