@Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.chebox_Every_day: // chebox_Every_day.setChecked(true); MobclickAgent.onEvent(context, "position_subscriber_sets_push_frequency_day"); value = (String) chebox_Every_day.getText(); break; case R.id.chebox_Every_weeky: MobclickAgent.onEvent(context, "position_subscriber_sets_push_frequency_week"); value = (String) chebox_Every_weeky.getText(); break; case R.id.chebox_Every_weekys: MobclickAgent.onEvent(context, "position_subscriber_sets_push_frequency_2week"); value = (String) chebox_Every_weekys.getText(); break; case R.id.chebox_Every_month: MobclickAgent.onEvent(context, "position_subscriber_sets_push_frequency_moonth"); value = (String) chebox_Every_month.getText(); break; } }
public void onSubmit(View v) { RadioButton rb1 = (RadioButton) radioGroup1.findViewById(radioGroup1.getCheckedRadioButtonId()); Toast.makeText(CreditsDebits.this, rb1.getText(), Toast.LENGTH_SHORT).show(); RadioButton rb2 = (RadioButton) radioGroup2.findViewById(radioGroup2.getCheckedRadioButtonId()); Toast.makeText(CreditsDebits.this, rb2.getText(), Toast.LENGTH_SHORT).show(); }
// This method will check the radio button corresponding to the saved answer public void checkButtonIfAnswer(String s) { // For both multi3 and multi5 types get text from first 3 radio buttons // and compare to our string, if match toggle the button. if (this.currentQuestion.type.equalsIgnoreCase("multi3") || this.currentQuestion.type.equalsIgnoreCase("multi5")) { String rb1 = choice1.getText().toString(); String rb2 = choice2.getText().toString(); String rb3 = choice3.getText().toString(); if (s.equalsIgnoreCase(rb1)) { choice1.toggle(); } if (s.equalsIgnoreCase(rb2)) { choice2.toggle(); } if (s.equalsIgnoreCase(rb3)) { choice3.toggle(); } // For multi5 type get text from last 2 radio buttons // and compare to our string, if match toggle the button. if (this.currentQuestion.type.equalsIgnoreCase("multi5")) { String rb4 = choice4.getText().toString(); String rb5 = choice5.getText().toString(); if (s.equalsIgnoreCase(rb4)) { choice4.toggle(); } if (s.equalsIgnoreCase(rb5)) { choice5.toggle(); } } } }
public void button1_onClick(View v) { String customerName = edittext1.getText().toString(); String customerEstablishmentName = edittext2.getText().toString(); String customerAddress = edittext3.getText().toString(); String customerContactNumber = edittext4.getText().toString(); String customerEmail = edittext5.getText().toString(); String customerCity = edittext6.getText().toString(); String employeeName = autocompletetextview1.getText().toString(); String productName = autocompletetextview2.getText().toString(); String customerInTime = edittext7.getText().toString(); String customerOutTime = edittext8.getText().toString(); String followUpDate = edittext9.getText().toString(); StringTokenizer st = new StringTokenizer(followUpDate, "-"); day1 = st.nextToken(); month1 = st.nextToken(); year1 = st.nextToken(); DecimalFormat dformat = new DecimalFormat("00"); month1 = dformat.format(Double.valueOf(month1)); day1 = dformat.format(Double.valueOf(day1)); String customerFollowUpDate = year1 + month1 + day1; String customerRemark = edittext10.getText().toString(); RadioButton radiobutton1 = (RadioButton) findViewById(radiobuttongroup1.getCheckedRadioButtonId()); String customerHasComputer = radiobutton1.getText().toString(); RadioButton radiobutton2 = (RadioButton) findViewById(radiobuttongroup2.getCheckedRadioButtonId()); String customerHasInternet = radiobutton2.getText().toString(); RadioButton radiobutton3 = (RadioButton) findViewById(radiobuttongroup3.getCheckedRadioButtonId()); String customerUsesSoftware = radiobutton3.getText().toString(); DatabaseHandler obj = new DatabaseHandler(this); List<String> employeeIdList = obj.getEmployeeId(employeeName); String employeeId = employeeIdList.get(0); List<String> productIdList = obj.getProductId(productName); String productId = productIdList.get(0); obj.updateDoctorInfo( customerName, customerEstablishmentName, customerAddress, customerContactNumber, customerEmail, customerCity, employeeId, productId, customerInTime, customerOutTime, customerHasComputer, customerUsesSoftware, customerHasInternet, customerFollowUpDate, customerRemark); Toast.makeText(getBaseContext(), "Customer record updated", Toast.LENGTH_SHORT).show(); finish(); }
public void nextactivity_visualdiscrimination(View view) { rgrp1 = (RadioGroup) findViewById(R.id.rgrp1); radioButtonID1 = rgrp1.getCheckedRadioButtonId(); rgrp2 = (RadioGroup) findViewById(R.id.rgrp2); radioButtonID2 = rgrp2.getCheckedRadioButtonId(); int radioId1 = 0; int radioId2 = 0; if (!skip_pressed) { // if (radioButtonID1 <= 0 || radioButtonID2 <= 0) { // // Toast.makeText(getBaseContext(), "Please select one option from each type // !", Toast.LENGTH_LONG).show(); // if(radioButtonID1 <= 0) // radioButton1 = "NA"; // if(radioButtonID2 <= 0) // radioButton2 ="NA"; // } // else { RadioButton checkedbutton = (RadioButton) findViewById(radioButtonID1); radioId1 = rgrp1.getCheckedRadioButtonId(); if (radioId1 <= 0) radioButton1 = "NA"; else radioButton1 = checkedbutton.getText().toString(); RadioButton checkedbutton1 = (RadioButton) findViewById(radioButtonID2); radioId2 = rgrp2.getCheckedRadioButtonId(); if (radioId2 <= 0) radioButton2 = "NA"; else radioButton2 = checkedbutton1.getText().toString(); // } SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString("Radiobuttonteaming1", radioButton1); editor.putString("Radiobuttonteaming2", radioButton2); editor.putInt("teamingidround1", radioId1); editor.putInt("teamingidround2", radioId2); editor.putString("Teamingskipped", "notskipped"); editor.commit(); Intent intent = new Intent(this, RecordVisualDiscrimination.class); intent.putExtra("activity", "nextvisualdiscrimination"); intent.putExtra("TesterName", user_name); startActivity(intent); // } } else { SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString("Radiobuttonteaming1", "NA"); editor.putString("Radiobuttonteaming2", "NA"); editor.putString("Teamingskipped", "skipped"); editor.commit(); Intent intent = new Intent(this, RecordVisualDiscrimination.class); intent.putExtra("activity", "nextvisualdiscrimination"); intent.putExtra("TesterName", user_name); startActivity(intent); } }
@Override protected void onRecover(Object object) { resetResult(); if (object != null) { BeneficiaryValue beneficiary = (BeneficiaryValue) object; if (currentTypeCode.equals(ServiceCode.BANK_TRANSFER_PAYMENT) || beneficiary.serviceType.equals(Contants.BANK_TRANSFER)) { bankTransferNameEditText.setText(beneficiary.beneficiaryName); expandFocusResultChange(bankTransferNameEditText.getText().toString()); ibanEdtiText.setText(beneficiary.beneficiaryIban); iban = beneficiary.beneficiaryIban; } else if (currentTypeCode.equals(ServiceCode.TRANSFER_ENTRY_PAYMENT) || beneficiary.serviceType.equals(Contants.TRANSFER_ENTRY)) { for (int i = 0; i < tranGroup.getChildCount(); i++) { RadioButton radioButton = (RadioButton) tranGroup.getChildAt(i); if (radioButton.getText().equals(beneficiary.beneficiaryName)) { radioButton.setChecked(true); } if (radioButton.getText().equals(selectedAccountsModel.getAccountAlias())) { radioButton.setEnabled(false); } } } else if (currentTypeCode.equals(ServiceCode.SIM_TOP_UP) || beneficiary.serviceType.equals(Contants.SIM_TOP_UP)) { simTopUpNameEdit.setText(beneficiary.beneficiaryName); phoneNumberEdit.setText(beneficiary.beneficiaryPhoneNumber); String destProvider = DestProvider.getDsstProvider(beneficiary.operator); operatorText.setText(destProvider); if (!simTopUpNameEdit.getText().toString().equals("")) { expandFocusResultChange(simTopUpNameEdit.getText().toString()); } else { expandFocusResultChange(phoneNumberEdit.getText().toString()); } } else if (currentTypeCode.equals(ServiceCode.CARD_RECHARGE_PAYMENT) || beneficiary.serviceType.equals(Contants.PREPAID_CARD_RELOAD)) { beneficiaryNameEditText.setText(beneficiary.beneficiaryName); String cardNum = beneficiary.beneficiaryCardNumber.substring( beneficiary.beneficiaryCardNumber.length() - 4, beneficiary.beneficiaryCardNumber.length()); cardNumberEditText.setText(cardNum); expandFocusResultChange(beneficiaryNameEditText.getText().toString()); } } else { // 如果是显示的,就屏蔽一下 for (int i = 0; i < tranGroup.getChildCount(); i++) { RadioButton radioButton = (RadioButton) tranGroup.getChildAt(i); if (radioButton.getText().equals(selectedAccountsModel.getAccountAlias())) { radioButton.setEnabled(false); } } } payees_layout.removeAllViews(); }
public void seleccionSexo() { int idRadioSeleccionado = grupoSexo.getCheckedRadioButtonId(); RadioButton radioSeleccionado = (RadioButton) findViewById(idRadioSeleccionado); if (radioSeleccionado.getText().equals("Varon")) { sexoSeleccionado = "Sr: "; } else if (radioSeleccionado.getText().equals("Hembra")) { sexoSeleccionado = "Sra: "; } else { Toast.makeText(getApplicationContext(), "Sexo sin seleccionar", Toast.LENGTH_SHORT).show(); } }
// @Override public void onClick(View v) { Context context = getApplicationContext(); switch (v.getId()) { case R.id.btnPronto: RadioGroup tipo = (RadioGroup) findViewById(R.id.rGroupTipo); RadioButton tipoSelected = (RadioButton) findViewById(tipo.getCheckedRadioButtonId()); RadioGroup tamanho = (RadioGroup) findViewById(R.id.rGroupTamanho); RadioButton tamanhoSelected = (RadioButton) findViewById(tamanho.getCheckedRadioButtonId()); EditText fone = (EditText) findViewById(R.id.tbxFone); CheckBox EmConstrucao = (CheckBox) findViewById(R.id.ckbEmConstrucao); /*pegar coordenada GPS*/ LocationManager locManager = (LocationManager) getSystemService(LOCATION_SERVICE); Location location = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100, 1, this); try { db_imovel = new EstateData(this); SQLiteDatabase db = db_imovel.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(TYPE, tipoSelected.getText().toString()); values.put(SIZE, tamanhoSelected.getText().toString()); values.put(STATUS, EmConstrucao.isChecked() ? "1" : "0"); values.put(PHONE, Integer.parseInt(fone.getText().toString())); values.put(LATITUDE, location.getLatitude()); values.put(LONGITUDE, location.getLongitude()); db.insertOrThrow(TABLE_NAME, null, values); Toast toast = Toast.makeText(context, R.string.InfoSucess, Toast.LENGTH_SHORT); toast.show(); } catch (NumberFormatException e) { Toast toast = Toast.makeText(context, R.string.ErrorNumber, Toast.LENGTH_SHORT); toast.show(); } break; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); searchEditText = (EditText) findViewById(R.id.etSearch); moviesSearchRadioButton = (RadioButton) findViewById(R.id.rMovie); peopleSearchRadioButton = (RadioButton) findViewById(R.id.rPeople); searchRadioGroup = (RadioGroup) findViewById(R.id.rgSelector); searchButton = (Button) findViewById(R.id.bSearch); searchTypeTextView = (TextView) findViewById(R.id.search_type_text_view); moviesSearchRadioButton.setOnClickListener(radioButtonListener); peopleSearchRadioButton.setOnClickListener(radioButtonListener); searchButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { String query = searchEditText.getText().toString(); if (moviesSearchRadioButton.isChecked()) { longToast(moviesSearchRadioButton.getText() + " " + query); } else if (peopleSearchRadioButton.isChecked()) { longToast(peopleSearchRadioButton.getText() + " " + query); } } }); searchEditText.setOnFocusChangeListener(new DftTextOnFocusListener("Search")); int id = searchRadioGroup.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(id); searchTypeTextView.setText(radioButton.getText()); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.findAllViewsById(); moviesSearchRadioButton.setOnClickListener(radioButtonListener); peopleSearchRadioButton.setOnClickListener(radioButtonListener); searchButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { String query = searchEditText.getText().toString(); if (moviesSearchRadioButton.isChecked()) { longToast(moviesSearchRadioButton.getText() + " " + query); } else if (peopleSearchRadioButton.isChecked()) { longToast(peopleSearchRadioButton.getText() + " " + query); } } }); searchEditText.setOnFocusChangeListener(new DftTextOnFocusListener(getString(R.string.search))); int id = searchRadioGroup.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(id); searchTypeTextView.setText(radioButton.getText()); }
private ContentValues getContent() { ContentValues content = new ContentValues(); EditText aux; Long id = getId(); if (id != -1) { content.put("_id", id); } // date DatePicker dp = (DatePicker) findViewById(R.id.date); GregorianCalendar date = new GregorianCalendar(dp.getYear(), dp.getMonth(), dp.getDayOfMonth()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); content.put("date", sdf.format(date.getTime())); // km aux = (EditText) findViewById(R.id.km); content.put("odometer", Float.parseFloat(aux.getText().toString())); // liters aux = (EditText) findViewById(R.id.liters); content.put("liters", Float.parseFloat(aux.getText().toString())); // type RadioGroup aux2 = (RadioGroup) findViewById(R.id.type); RadioButton aux3 = (RadioButton) findViewById(aux2.getCheckedRadioButtonId()); content.put("fuel", aux3.getText().toString()); return content; }
/** * 获得单选注码 * * @param check * @return */ private String getRadioCode() { String betCode = ""; for (RadioButton radio : radioBtns) { if (radio.isChecked()) { betCode += touzhuDialog.getBetCode(radio.getText().toString()) + "_" + PublicMethod.isTen(touzhuDialog.getBeishu()) + "_" + oneAmt * 100 + "_" + getRadioZhu(radio.getText().toString()) * oneAmt * 100 + "!"; } } return betCode.substring(0, betCode.length() - 1); }
@Override public String getAnswer() { if (radioGroup != null) { RadioButton selectedRadioButton = ((RadioButton) radioGroup.findViewById(radioGroup.getCheckedRadioButtonId())); return selectedRadioButton.getText().toString(); } else { return ""; } }
@Override public void onClick(View v) { // Perform action on clicks RadioButton rb = (RadioButton) v; rb.setChecked(true); splashMenu.setRobotType(rb.getId()); Toast.makeText( mDialog.getContext(), mSelectionMessage + " " + rb.getText(), Toast.LENGTH_SHORT) .show(); mDialog.dismiss(); }
@Override public void onClick(View arg0) { Button searchB = (Button) findViewById(R.id.searchButton); searchB.setClickable(false); s_keyword = keywordText.getText().toString(); // RadioGroup rg=(RadioGroup)findViewById(R.id.radioDistanceGroup); // RadioButton b_within = (RadioButton)this.findViewById(rg.getCheckedRadioButtonId()); // s_within = b_within.getText().toString(); // // RadioGroup rg2=(RadioGroup)findViewById(R.id.radioTimeGroup); // RadioButton b_date = (RadioButton)this.findViewById(rg2.getCheckedRadioButtonId()); // s_date = b_date.getText().toString(); // int distId = rDistanceGroup.getCheckedRadioButtonId(); distanceButton = (RadioButton) findViewById(distId); s_within = (String) distanceButton.getText(); s_within = s_within.substring(0, s_within.length() - 2); int timeId = rTimeGroup.getCheckedRadioButtonId(); timeButton = (RadioButton) findViewById(timeId); s_date = (String) timeButton.getText(); System.out.println("distance and date: " + s_within + "," + s_date); s_date = s_date.trim(); s_date = s_date.replace(" ", "+"); // if (s_date.equalsIgnoreCase("This Week")){ // s_date = "This+Week"; // }else if (s_date.equalsIgnoreCase("Next Week")){ // s_date = "Next+Week"; // }else if (s_date.equalsIgnoreCase("Today")){ // s_date = "Today"; // } // s_category = new LongRunningGetIO().execute(); }
/** 每个分组按钮的长按时间 */ public boolean onLongClick(View arg0) { // TODO Auto-generated method stub RadioButton radioButton = (RadioButton) arg0; String typeName = radioButton.getText().toString(); if (!typeName.equals("全部")) { selectedTypeNameString = typeName; selectedTypeId = radioButton.getId(); showDialog(SELECT_OPR); } else { Toast.makeText(MainActivity.this, "该分组不允许修改!", Toast.LENGTH_SHORT).show(); } return false; }
private void load(Long id) { ContentValues content = db.get(id); String aux; // date aux = (String) content.get("date"); DatePicker dp = (DatePicker) findViewById(R.id.date); int year = Integer.parseInt(aux.substring(0, 4)); // datepicke month starts with 0 int month = Integer.parseInt(aux.substring(5, 7)) - 1; int day = Integer.parseInt(aux.substring(8, 10)); dp.updateDate(year, month, day); // km EditText auxText = (EditText) findViewById(R.id.km); aux = (String) content.get("odometer"); auxText.setText(aux); // liters auxText = (EditText) findViewById(R.id.liters); aux = (String) content.get("liters"); auxText.setText(aux); Log.d("TAG", "liters = " + aux); // type aux = (String) content.get("fuel"); RadioGroup aux2 = (RadioGroup) findViewById(R.id.type); for (int i = 0; i < aux2.getChildCount(); i++) { RadioButton aux3 = (RadioButton) aux2.getChildAt(i); Log.d("TAG", ">>" + aux3.getText().toString() + "==" + aux); if (aux3.getText().toString().equals(aux)) { Log.d("TAG", ">> Y << " + Integer.toString(i)); aux2.check(aux3.getId()); break; } } }
// This method saves the current answer to the question object and is used on // both the forward and back buttons public void saveAnswer() { // Save the answer from user, depending on question type if (this.currentQuestion.type.equalsIgnoreCase("text")) { this.currentQuestion.answerText = this.textAnswer.getText().toString(); } else if (this.currentQuestion.type.equalsIgnoreCase("multi3") || this.currentQuestion.type.equalsIgnoreCase("multi5")) { // Find checked radio button from group and get answer RadioButton ans = (RadioButton) findViewById(multiChoices.getCheckedRadioButtonId()); this.currentQuestion.answerText = ans.getText().toString(); } else if (this.currentQuestion.type.equalsIgnoreCase("rating")) { this.currentQuestion.answerText = Integer.toString((int) this.ratingbar.getRating()); } // Re-save the current question at the current position in the list, now with its answer string // - set(pos, obj) this.myApp.getCurrentSurvey().questionsList.set(this.currentQuestNo, this.currentQuestion); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tv); // setTitle("ActivityByTv"); sz = (EditText) findViewById(R.id.sz); zm = (EditText) findViewById(R.id.zm); zf = (EditText) findViewById(R.id.zf); rz = (TextView) findViewById(R.id.chk_rz); bt = (Button) findViewById(R.id.chk); rg = (RadioGroup) findViewById(R.id.rg); for (int i = 0; i < rg.getChildCount(); i++) { rb = (RadioButton) rg.getChildAt(i); if (rb.isSelected()) { sex = rb.getText().toString(); } } bt.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String chk_sz = sz.getText().toString(); String chk_zm = zm.getText().toString(); String chk_zf = zf.getText().toString(); if (chk_sz == null || chk_sz.equals("")) { sz.setError("请输入数字!"); return; } else if (chk_zm == null || chk_zm.equals("")) { zm.setError("请输入字母!"); return; } else if (chk_zf == null || chk_zf.equals("")) { zf.setError("请输入字符!"); return; } else { Toast.makeText(ActivityTv.this, sex, 5).show(); Intent it = new Intent(ActivityTv.this, ChkActivity.class); it.putExtra("shuzi", chk_sz); it.putExtra("zimu", chk_zm); it.putExtra("zifu", chk_zf); startActivity(it); } } }); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Tell AQUtility about context: it can use this globally...which is really handy! AQUtility.setContext(getApplication()); // Load default preferences PreferenceManager.setDefaultValues(this, R.xml.preferences, false); findAllViewsById(); View.OnClickListener radioButtonListener = new View.OnClickListener() { public void onClick(View v) { RadioButton radioButton = (RadioButton) v; searchTypeTextView.setText("Searching for " + radioButton.getText()); } }; moviesSearchRadioButton.setOnClickListener(radioButtonListener); peopleSearchRadioButton.setOnClickListener(radioButtonListener); searchButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { String query = searchEditText.getText().toString(); if (moviesSearchRadioButton.isChecked()) { PerformFilmSearchTask task = new PerformFilmSearchTask(FilmSearchAppActivity.this); task.execute(query); } else if (peopleSearchRadioButton.isChecked()) { PerformPersonSearchTask task = new PerformPersonSearchTask(FilmSearchAppActivity.this); task.execute(query); } } }); int radioId = searchRadioGroup.getCheckedRadioButtonId(); RadioButton radioButton = (RadioButton) findViewById(radioId); searchTypeTextView.setText(radioButton.getText()); }
@Override public void dismiss() { if (outCbx != null && outCbx.isChecked()) { int id = radioGroup.getCheckedRadioButtonId(); RadioButton rbt = (RadioButton) radioGroup.findViewById(id); Integer old_tag = (Integer) outCbx.getTag(); if (old_tag == null) { super.dismiss(); return; } if (old_tag != id) { outCbx.setTag(id); outCbx.setText(rbt.getText()); } else { outCbx.setTag(-1); } outCbx.setChecked(false); } super.dismiss(); }
public static RadioGroup configureCalendarRestoreStrategy( View view, final CalendarRestoreStrategyChangedListener dialog) { RadioGroup restorePlanStrategie = (RadioGroup) view.findViewById(R.id.restore_calendar_handling); restorePlanStrategie.setOnCheckedChangeListener( new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { dialog.onCheckedChanged(); } }); String calendarId = MyApplication.PrefKey.PLANNER_CALENDAR_ID.getString("-1"); String calendarPath = MyApplication.PrefKey.PLANNER_CALENDAR_PATH.getString(""); RadioButton configured = (RadioButton) view.findViewById(R.id.restore_calendar_handling_configured); if ((calendarId.equals("-1")) || calendarPath.equals("")) { configured.setEnabled(false); } else { configured.setText(configured.getText() + " (" + calendarPath + ")"); } return restorePlanStrategie; }
public String getAswerIDEN() { String Answer = ""; if (idType.equals(Constantes.RADIO)) { RadioGroup rg = (RadioGroup) view; int id = rg.getCheckedRadioButtonId(); if (id != -1) { RadioButton rb = (RadioButton) rg.findViewById(id); Answer = rb.getText().toString(); } else Answer = ""; } if (idType.equals(Constantes.CHECK)) { for (CheckBox c : checkBoxes) { if (c.isChecked()) Answer = c.getText().toString(); else Answer = ""; } } if (idType.equals(Constantes.TEXT) || idType.equals(Constantes.NUM)) { Answer = ((EditText) view).getText().toString(); } return Answer; }
public String selectRadioBtn() { radioButton = (RadioButton) findViewById(rgFundType.getCheckedRadioButtonId()); String rbText = radioButton.getText().toString(); String selectName = null; switch (rbText) { case "全部": selectName = "All"; break; case "股票": selectName = "Stock"; break; case "混合": selectName = "Mixed"; break; case "债券": selectName = "Bond"; break; case "货币": selectName = "Currency"; break; } return selectName; }
public String getAswer3G() { String Answer = ""; if (idType.equals(Constantes.RADIO)) { RadioGroup rg = (RadioGroup) view; int id = rg.getCheckedRadioButtonId(); if (id != -1) { RadioButton rb = (RadioButton) rg.findViewById(id); Answer = rb.getText().toString(); } else Answer = ""; } if (idType.equals(Constantes.CHECK)) { int count = 0; for (CheckBox c : checkBoxes) { if (c.isChecked()) { if (checkBoxes.indexOf(c) == 0) { Answer += c.getText().toString(); } else { Answer += ";" + c.getText().toString(); } count++; } if (count == 0) Answer = ""; } } if (idType.equals(Constantes.TEXT) || idType.equals(Constantes.NUM)) { Answer = ((EditText) view).getText().toString(); } if (idType.equals(Constantes.DATE)) { Answer = editTexts.get(0).getText().toString(); } return Answer; }
public void clicknext(View view) { // Intent bbb = new Intent(getApplicationContext(), quizfrom.class); // startActivity(bbb); // Select Answer rigth if (myOption1.isChecked() || myOption2.isChecked() || myOption3.isChecked() || myOption4.isChecked()) { // Keep myAnswer String selectMyAns; if (myOption1.isChecked()) { selectMyAns = myOption1.getText().toString(); } else if (myOption2.isChecked()) { selectMyAns = myOption2.getText().toString(); } else if (myOption3.isChecked()) { selectMyAns = myOption3.getText().toString(); } else { selectMyAns = myOption4.getText().toString(); } Log.d(" Database: ", " selectMyAns >>>>> " + selectMyAns); String check; if (selectMyAns.equals(trueAns)) { check = "true"; } else { check = "false"; } // int numIndex = numQ - 2; object1.id = Integer.toString(numQ - 1); object1.idParam = text; object1.strQuestion = strQ; object1.strMyAns = selectMyAns; object1.strAns = trueAns; object1.strCheck = check; myArrList.add(object1); /*myAnswer[numIndex][0] = varID; myAnswer[numIndex][1] = text; myAnswer[numIndex][2] = strQ; myAnswer[numIndex][3] = selectMyAns; myAnswer[numIndex][4] = trueAns; myAnswer[numIndex][5] = check;*/ for (int index = 0; index < myArrList.size(); index++) { Log.d(" check: ", " Round Score >>>>> " + myArrList.get(index).strQuestion); // Toast.makeText(getApplicationContext(), "Id is :" + Object.id, // Toast.LENGTH_SHORT).show(); } if (numQ > 10) { // Nextpage. Show Score & send parameter myAnswer Intent intent; Bundle bundle = new Bundle(); intent = new Intent(getApplicationContext(), pagemyscore.class); /**/ Bundle d = new Bundle(); d.putSerializable("myscore", myArrList); intent.putExtras(d); startActivity(intent); } else { // Next Question showNotes(curNotes); } } else { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage("กรุณาเลือกคำตอบ"); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } }
public void onRadioButtonClicked(View view) { // store the text corresponding to the RadioButton which is clicked // initialize the string variable String link = null; radioCountyGroup = (RadioGroup) findViewById(R.id.radioGroupCounties); // Is the button now checked? boolean checked = ((RadioButton) view).isChecked(); // Check which radio button was clicked switch (view.getId()) { case R.id.radioCarlow: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Carlow); break; case R.id.radioCavan: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Cavan); break; case R.id.radioClare: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Clare); break; case R.id.radioCork: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Cork); break; case R.id.radioDonegal: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Donegal); break; case R.id.radioDublinCity: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.DublinCity); break; case R.id.radioDublinNorth: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.DublinNorth); break; case R.id.radioGalway: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Galway); break; case R.id.radioKerry: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Kerry); break; case R.id.radioKildare: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Kildare); break; case R.id.radioKilkenny: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Kilkenny); break; case R.id.radioLaois: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Laois); break; case R.id.radioLeitrim: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Leitrim); break; case R.id.radioLimerick: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Limerick); break; case R.id.radioLongford: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Longford); break; case R.id.radioLouth: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Louth); break; case R.id.radioMayo: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Mayo); break; case R.id.radioMeath: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Meath); break; case R.id.radioMonaghan: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Monaghan); break; case R.id.radioOffaly: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Offaly); break; case R.id.radioRoscommon: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Roscommon); break; case R.id.radioSligo: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Sligo); break; case R.id.radioTipperary: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Tipperary); break; case R.id.radioWaterford: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Waterford); break; case R.id.radioWestmeath: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Westmeath); break; case R.id.radioWexford: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Wexford); break; case R.id.radioWicklow: if (checked) link = DisplayClinicsRadioActivity.this.getResources().getString(R.string.Wicklow); break; } // get selected radio button from radioGroup int selectedId = radioCountyGroup.getCheckedRadioButtonId(); // find the radiobutton by returned id radioCountyButton = (RadioButton) findViewById(selectedId); Intent intent = new Intent(this, DisplayClinicsListActivity.class); intent.putExtra("radioChosen", link); // pass link to the next Activity intent.putExtra( "radioCountySelected", radioCountyButton.getText()); // pass button text to the next activity startActivity(intent); }
public void onRadioButtonClicked(View v) { // if(en==1) // { // rgroup.setEnabled(false); // radioButton1.setEnabled(false); // radioButton2.setEnabled(false); // radioButton3.setEnabled(false); // radioButton4.setEnabled(false); // } if ((v.getId() == R.id.option1)) { if (radioButton1.isChecked()) { ans = radioButton1.getText().toString(); if (ans.equals(answer)) { Toast t = Toast.makeText(this, "You Tick Right Answere :" + ans, Toast.LENGTH_SHORT); t.setGravity(Gravity.FILL_HORIZONTAL, 0, 0); t.show(); r++; } else { // String str=("You Tick Worng Answere. The Right Answer is "+answer); // toasttext.setText(str); radioButton1.setBackgroundColor(2550000); Context context = getApplicationContext(); LayoutInflater inflater = getLayoutInflater(); View toastRoot = inflater.inflate(R.layout.mytoast, null); Toast toast = new Toast(context); toast.setView(toastRoot); toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0); toast.show(); w++; } } String res1 = ("Your Talent :" + r + "/" + (r + w)); result1.setText(res1); } if (v.getId() == R.id.option2) { ans = radioButton2.getText().toString(); if (radioButton2.isChecked()) { if (ans.equals(answer)) { Toast t = Toast.makeText(this, "You Tick Right Answere :" + ans, Toast.LENGTH_SHORT); t.setGravity(Gravity.FILL_HORIZONTAL, 0, 0); t.show(); r++; } else { Toast t = Toast.makeText( this, "You Tick Worng Answere. The Right Answer is " + answer, Toast.LENGTH_SHORT); t.setGravity(Gravity.FILL_HORIZONTAL, 0, 0); t.show(); w++; } } String res1 = ("Your Talent :" + r + "/" + (r + w)); result1.setText(res1); } if (v.getId() == R.id.option3) { ans = radioButton3.getText().toString(); if (radioButton3.isChecked()) { if (ans.equals(answer)) { Toast t = Toast.makeText(this, "You Tick Right Answere :" + ans, Toast.LENGTH_SHORT); t.setGravity(Gravity.FILL_HORIZONTAL, 0, 0); t.show(); r++; } else { Toast t = Toast.makeText( this, "You Tick Worng Answere. The Right Answer is " + answer, Toast.LENGTH_SHORT); t.setGravity(Gravity.FILL_HORIZONTAL, 0, 0); t.show(); w++; } } String res1 = ("Your Talent :" + r + "/" + (r + w)); result1.setText(res1); } if (v.getId() == R.id.option4) { ans = radioButton4.getText().toString(); if (radioButton4.isChecked()) { if (ans.equals(answer)) { Toast t = Toast.makeText(this, "You Tick Right Answere :" + ans, Toast.LENGTH_SHORT); t.setGravity(Gravity.FILL_HORIZONTAL, 0, 0); t.show(); r++; } else { Toast t = Toast.makeText( this, "You Tick Worng Answere. The Right Answer is " + answer, Toast.LENGTH_SHORT); t.setGravity(Gravity.FILL_HORIZONTAL, 0, 0); t.show(); w++; } // en++; } String res1 = ("Your Talent :" + r + "/" + (r + w)); result1.setText(res1); } }
@Override public void onCheckedChanged(RadioGroup rg, int checkedId) { if (modifyingRadioButtons) { return; } modifyingRadioButtons = true; RadioGroup teamARG = (RadioGroup) findViewById(R.id.teamaradiogroup); RadioGroup teamBRG = (RadioGroup) findViewById(R.id.teambradiogroup); RadioButton teamARB = (RadioButton) findViewById(teamARG.getCheckedRadioButtonId()); RadioButton teamBRB = (RadioButton) findViewById(teamBRG.getCheckedRadioButtonId()); int aPoints = Integer.parseInt(teamARB.getText().toString()); int bPoints = Integer.parseInt(teamBRB.getText().toString()); // somebody needs to be reset to 0 if ((aPoints > 0 && bPoints > 0) || (aPoints < 0 && bPoints < 0)) { // team A was clicked, so team B should reset if (rg.equals(teamARG)) { bPoints = 0; ((RadioButton) findViewById(R.id.teambradio0)).setChecked(true); } // team B was clicked, so team A should reset else { aPoints = 0; ((RadioButton) findViewById(R.id.teamaradio0)).setChecked(true); } } if (aPoints > 0 || bPoints > 0) { enableBonusBoxes(); } else { clearBonusBoxes(); disableBonusBoxes(); } Tossup oldTossup = game.currTossup(); Tossup t; if (aPoints >= bPoints) { t = new Tossup( game.getCurrTossupNum(), game.getTeamA(), aPoints, game.getTeamB(), bPoints, oldTossup.isTiebreaker()); } else { t = new Tossup( game.getCurrTossupNum(), game.getTeamB(), bPoints, game.getTeamA(), aPoints, oldTossup.isTiebreaker()); } game.updateCurrTossup(t); updateGlobalScore(); updatePlayerSpinner(); updateBonusBoxes(t); modifyingRadioButtons = false; }
@Override public void onClick(View view) { if (view == findViewById(R.id.btn1)) { if (rg.getCheckedRadioButtonId() != -1) { RadioButton rb = (RadioButton) findViewById(rg.getCheckedRadioButtonId()); if (rb.getText().toString().contentEquals("General Knowledge")) { android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(this); builder.setIcon(R.mipmap.ic_launcher); builder.setTitle("Choose the Exam Duration : "); final CharSequence[] items1 = {"10", "20", "30"}; builder .setPositiveButton( "Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Toast.makeText(getBaseContext(), "OK clicked!", Toast.LENGTH_SHORT).show(); Intent start = new Intent(getBaseContext(), GeneralKnowledge.class); start.putExtra("questionCount", questionCount); startActivity(start); } }) .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(getBaseContext(), "Cancel clicked!", Toast.LENGTH_SHORT) .show(); } }) .setSingleChoiceItems( items1, -1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int pos) { questionCount = Integer.parseInt(items1[pos].toString()); Toast.makeText( getApplicationContext(), "You Choose : " + items1[pos], Toast.LENGTH_SHORT) .show(); } }); android.support.v7.app.AlertDialog ad = builder.create(); ad.show(); } else if (rb.getText().toString().contentEquals("Aptitude and Reasoning")) { android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(this); builder.setIcon(R.mipmap.ic_launcher); builder.setTitle("Choose the Exam Duration : "); final CharSequence[] items2 = {"10", "20", "30"}; builder .setPositiveButton( "Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Toast.makeText(getBaseContext(), "OK clicked!", Toast.LENGTH_SHORT).show(); Intent start = new Intent(getBaseContext(), AptitudeReasoning.class); start.putExtra("questionCount", questionCount); startActivity(start); } }) .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(getBaseContext(), "Cancel clicked!", Toast.LENGTH_SHORT) .show(); } }) .setSingleChoiceItems( items2, -1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int pos) { questionCount = Integer.parseInt(items2[pos].toString()); Toast.makeText( getApplicationContext(), "You Choose : " + items2[pos], Toast.LENGTH_SHORT) .show(); } }); android.support.v7.app.AlertDialog ad = builder.create(); ad.show(); } else { android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(this); builder.setIcon(R.mipmap.ic_launcher); builder.setTitle("Choose the Exam Duration : "); final CharSequence[] items = {"10", "20", "30"}; // builder.setMessage("Select the no of questionss you want to have in exam : "); builder .setPositiveButton( "Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Toast.makeText(getBaseContext(), "OK clicked!", Toast.LENGTH_SHORT).show(); Intent start = new Intent(getBaseContext(), Programming.class); start.putExtra("questionCount", questionCount); startActivity(start); } }) .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(getBaseContext(), "Cancel clicked!", Toast.LENGTH_SHORT) .show(); } }) .setSingleChoiceItems( items, -1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int pos) { questionCount = Integer.parseInt(items[pos].toString()); Toast.makeText( getApplicationContext(), "You Choose : " + items[pos], Toast.LENGTH_SHORT) .show(); } }); android.support.v7.app.AlertDialog ad = builder.create(); ad.show(); } } else { Toast.makeText( getBaseContext(), "no Option is selected. Please select a option.", Toast.LENGTH_SHORT) .show(); } } if (view == findViewById(R.id.instruct)) { Intent intent = new Intent(getBaseContext(), Instructions.class); startActivity(intent); } }