Java Code Examples for android.widget.RadioButton

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project buzzwords, under directory /src/com/buzzwords/.

Source file: GameSetup.java

  22 
vote

/** 
 * Getter that returns the index of the checked radio button.
 * @return index of the checked radio button (-1 if none found)
 */
private int getCheckedRadioIndex(){
  if (BuzzWordsApplication.DEBUG) {
    Log.d(TAG,"getCheckedRadioValue()");
  }
  int checkedRadioIndex=-1;
  for (int i=0; i < GameSetup.ROUND_RADIOS.length; i++) {
    RadioButton test=(RadioButton)GameSetup.this.findViewById(GameSetup.ROUND_RADIOS[i][0]);
    if (test.isChecked()) {
      checkedRadioIndex=i;
      break;
    }
  }
  return checkedRadioIndex;
}
 

Example 2

From project Gmote, under directory /gmoteclient/src/org/gmote/client/android/.

Source file: Browse.java

  22 
vote

private void initCorrectRadioButton(){
  int radioButtonId;
  if (inGmoteStreamMode) {
    radioButtonId=R.id.radio_play_on_phone;
  }
 else {
    radioButtonId=R.id.radio_play_on_computer;
  }
  RadioButton radioButton=(RadioButton)findViewById(radioButtonId);
  radioButton.setChecked(true);
}
 

Example 3

From project GraduationProject, under directory /G-Card/src/Hello/Tab/Widget/.

Source file: SetupActivity.java

  22 
vote

private void setLaunchModePreferenceUI(){
  SharedPreferences prefs=Prefs.get(this);
  if (prefs.getBoolean("launchBrowserOrMaps",true)) {
    RadioButton automaticButton=(RadioButton)findViewById(R.id.auto_launch);
    automaticButton.setChecked(true);
  }
 else {
    RadioButton manualButton=(RadioButton)findViewById(R.id.manual_launch);
    manualButton.setChecked(true);
  }
}
 

Example 4

From project LEGO-MINDSTORMS-MINDdroid, under directory /android/src/com/lego/minddroid/.

Source file: Options.java

  22 
vote

@Override public void onClick(View v){
  RadioButton rb=(RadioButton)v;
  rb.setChecked(true);
  splashMenu.setRobotType(rb.getId());
  Toast.makeText(mDialog.getContext(),mSelectionMessage + " " + rb.getText(),Toast.LENGTH_SHORT).show();
  mDialog.dismiss();
}
 

Example 5

From project npr-android-app, under directory /src/org/npr/android/news/.

Source file: PlaylistActivity.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.playlist);
  Button clearButton=(Button)findViewById(R.id.PlaylistClear);
  RadioButton unreadButton=(RadioButton)findViewById(R.id.RadioButton01);
  RadioButton readButton=(RadioButton)findViewById(R.id.RadioButton02);
  clearButton.setOnClickListener(this);
  unreadButton.setChecked(filterUnread);
  readButton.setChecked(!filterUnread);
  unreadButton.setOnCheckedChangeListener(this);
  readButton.setOnCheckedChangeListener(this);
  refreshList();
  trackNow();
}
 

Example 6

From project platform_packages_apps_settings, under directory /src/com/android/settings/inputmethod/.

Source file: KeyboardLayoutDialogFragment.java

  22 
vote

private View inflateTwoLine(View convertView,ViewGroup parent,String label,String collection,boolean checked){
  View view=convertView;
  if (view == null || !isTwoLine(view)) {
    view=mInflater.inflate(com.android.internal.R.layout.simple_list_item_2_single_choice,parent,false);
    setTwoLine(view,true);
  }
  TextView headline=(TextView)view.findViewById(android.R.id.text1);
  TextView subText=(TextView)view.findViewById(android.R.id.text2);
  RadioButton radioButton=(RadioButton)view.findViewById(com.android.internal.R.id.radio);
  headline.setText(label);
  subText.setText(collection);
  radioButton.setChecked(checked);
  return view;
}
 

Example 7

From project wheelmap-android, under directory /wheelmap/wheelmap/src/main/java/org/wheelmap/android/fragment/.

Source file: WheelchairStateFragment.java

  22 
vote

@Override public void onClick(View v){
  DeselectAllRadioButtons();
  final RadioButton a=(RadioButton)v;
  a.setChecked(true);
  if (mListener != null)   mListener.onWheelchairStateSelect(getWheelchairState());
}
 

Example 8

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/speak/.

Source file: Speak.java

  21 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.i(TAG,"Displaying Search view");
  setContentView(R.layout.speak);
  speakControl=ControlFactory.getInstance().getSpeakControl();
  numPagesToSpeakDefinitions=speakControl.getNumPagesToSpeakDefinitions();
  for (  NumPagesToSpeakDefinition defn : numPagesToSpeakDefinitions) {
    RadioButton numChaptersCheckBox=(RadioButton)findViewById(defn.getRadioButtonId());
    numChaptersCheckBox.setText(defn.getPrompt());
  }
  mQueueCheckBox=(CheckBox)findViewById(R.id.queue);
  mRepeatCheckBox=(CheckBox)findViewById(R.id.repeat);
  mQueueCheckBox.setChecked(true);
  mRepeatCheckBox.setChecked(false);
  Log.d(TAG,"Finished displaying Speak view");
}
 

Example 9

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: SharedVipActivity.java

  21 
vote

private void displayRadioButtons(){
  for (  VirtualIp vip : vips) {
    RadioButton button=new RadioButton(getContext());
    button.setTextSize(TypedValue.COMPLEX_UNIT_DIP,14);
    button.setText(vip.getAddress() + "\n" + "Type: "+ vip.getType()+ "\n"+ "Load Balancer: "+ vip.getLoadBalancer().getName()+ "\n");
    if ((vip.getLoadBalancer().getPort().equals(loadBalancerPort) || !vip.getLoadBalancer().getRegion().equals(loadBalancerRegion))) {
      button.setEnabled(false);
    }
    vipGroup.addView(button);
    if (selectedVip != null && selectedVip.getId().equals(vip.getId())) {
      ((RadioButton)vipGroup.getChildAt(vipGroup.getChildCount() - 1)).toggle();
    }
  }
  vipGroup.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    RadioGroup group,    int checkedId){
      View radioButton=group.findViewById(checkedId);
      int index=group.indexOfChild(radioButton);
      if (vips[index].getLoadBalancer().getPort().equals(loadBalancerPort)) {
        showToast("Cannot use this Virtual IP. The same port cannot be used on multiple load balancers for a Shared Virtual IP.");
      }
 else       if (!vips[index].getLoadBalancer().getRegion().equals(loadBalancerRegion)) {
        showToast("Cannot use this Virtual IP. The Shared Virtual IP must come the same region as the new load balancer.");
      }
 else {
        Log.d("info","the selected vip is " + vips[index].getAddress());
        selectedVip=vips[index];
      }
    }
  }
);
}
 

Example 10

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: ApnPreference.java

  21 
vote

@Override public View getView(View convertView,ViewGroup parent){
  View view=super.getView(convertView,parent);
  View widget=view.findViewById(R.id.apn_radiobutton);
  if ((widget != null) && widget instanceof RadioButton) {
    RadioButton rb=(RadioButton)widget;
    if (mSelectable) {
      rb.setOnCheckedChangeListener(this);
      boolean isChecked=getKey().equals(mSelectedKey);
      if (isChecked) {
        mCurrentChecked=rb;
        mSelectedKey=getKey();
      }
      mProtectFromCheckedChange=true;
      rb.setChecked(isChecked);
      mProtectFromCheckedChange=false;
    }
 else {
      rb.setVisibility(View.GONE);
    }
  }
  View textLayout=view.findViewById(R.id.text_layout);
  if ((textLayout != null) && textLayout instanceof RelativeLayout) {
    textLayout.setOnClickListener(this);
  }
  return view;
}
 

Example 11

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: BooksOnBookshelf.java

  21 
vote

/** 
 * Add a radio box to the sort options dialogue.
 * @param sortDialog
 * @param group
 * @param style
 */
private void makeRadio(final AlertDialog sortDialog,final LayoutInflater inf,RadioGroup group,final BooklistStyle style){
  View v=inf.inflate(R.layout.booklist_style_menu_radio,null);
  RadioButton btn=(RadioButton)v;
  btn.setText(style.getDisplayName());
  if (mCurrentStyle.getCanonicalName().equalsIgnoreCase(style.getCanonicalName())) {
    btn.setChecked(true);
  }
 else {
    btn.setChecked(false);
  }
  group.addView(btn);
  btn.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      handleSelectedStyle(style.getCanonicalName());
      sortDialog.dismiss();
      return;
    }
  }
);
}
 

Example 12

From project creamed_glacier_app_settings, under directory /src/com/android/settings/.

Source file: ApnPreference.java

  21 
vote

@Override public View getView(View convertView,ViewGroup parent){
  View view=super.getView(convertView,parent);
  View widget=view.findViewById(R.id.apn_radiobutton);
  if ((widget != null) && widget instanceof RadioButton) {
    RadioButton rb=(RadioButton)widget;
    if (mSelectable) {
      rb.setOnCheckedChangeListener(this);
      boolean isChecked=getKey().equals(mSelectedKey);
      if (isChecked) {
        mCurrentChecked=rb;
        mSelectedKey=getKey();
      }
      mProtectFromCheckedChange=true;
      rb.setChecked(isChecked);
      mProtectFromCheckedChange=false;
    }
 else {
      rb.setVisibility(View.GONE);
    }
  }
  View textLayout=view.findViewById(R.id.text_layout);
  if ((textLayout != null) && textLayout instanceof RelativeLayout) {
    textLayout.setOnClickListener(this);
  }
  return view;
}
 

Example 13

From project DigitbooksExamples, under directory /DigitbooksExamples/src/fr/digitbooks/android/examples/chapitre10/.

Source file: PiCalculatorActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.pi_calculator_choice);
  mLaunchButton=(Button)findViewById(R.id.button);
  mProgress=(ProgressBar)findViewById(R.id.progress);
  editText=(EditText)findViewById(R.id.number_limit);
  mRadioGroup=(RadioGroup)findViewById(R.id.radio_group);
  mLaunchButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      if (Config.INFO_LOGS_ENABLED) {
        Log.i(LOG_TAG,"onClick");
      }
      if (v.getId() == R.id.button) {
        int limit=0;
        if (editText.getText().length() != 0)         limit=Integer.parseInt(editText.getText().toString());
        if (limit > 0 && limit <= ALGORITHME_LIMIT) {
          final RadioButton javaModeChecked=(RadioButton)findViewById(R.id.mode_java);
          if (javaModeChecked.isChecked()) {
            if (Config.INFO_LOGS_ENABLED) {
              Log.i(LOG_TAG,"Start Java method ");
            }
            if (task == null)             task=new PiCalculatingJavaTask(PiCalculatorActivity.this).execute(limit);
          }
 else {
            if (Config.INFO_LOGS_ENABLED) {
              Log.i(LOG_TAG,"Start Ndk method ");
            }
            if (task == null)             task=new PiCalculatingNdkTask(PiCalculatorActivity.this).execute(limit);
          }
        }
 else {
          Toast.makeText(PiCalculatorActivity.this,R.string.bad_limit,Toast.LENGTH_LONG).show();
        }
      }
    }
  }
);
}
 

Example 14

From project gast-lib, under directory /app/src/root/gast/playground/sensor/orientation/.

Source file: DetermineOrientationActivity.java

  21 
vote

/** 
 * Updates the views for when the selected sensor is changed
 */
private void updateSelectedSensor(){
  sensorManager.unregisterListener(this);
  selectedSensorId=sensorSelector.getCheckedRadioButtonId();
  if (selectedSensorId == R.id.accelerometerMagnetometer) {
    sensorManager.registerListener(this,sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),RATE);
    sensorManager.registerListener(this,sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),RATE);
  }
 else   if (selectedSensorId == R.id.gravityMagnetometer) {
    sensorManager.registerListener(this,sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY),RATE);
    sensorManager.registerListener(this,sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),RATE);
  }
 else   if ((selectedSensorId == R.id.gravitySensor)) {
    sensorManager.registerListener(this,sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY),RATE);
  }
 else {
    sensorManager.registerListener(this,sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR),RATE);
  }
  RadioButton selectedSensorRadioButton=(RadioButton)findViewById(selectedSensorId);
  selectedSensorValue.setText(selectedSensorRadioButton.getText());
}
 

Example 15

From project GeekAlarm, under directory /android/src/com/geek_alarm/android/adapters/.

Source file: AlarmSoundAdapter.java

  21 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.alarm_sound,null);
    convertView.setOnClickListener(listener);
    convertView.findViewById(R.id.radio).setOnClickListener(listener);
  }
  convertView.setTag(position);
  AlarmSound sound=getItem(position);
  TextView title=(TextView)convertView.findViewById(R.id.title);
  title.setText(sound.getTitle());
  RadioButton radio=(RadioButton)convertView.findViewById(R.id.radio);
  radio.setTag(position);
  radio.setChecked(selected == position);
  return convertView;
}
 

Example 16

From project GradeCalculator-Android, under directory /GradeCalculator/src/com/jetheis/android/grades/fragment/.

Source file: EditCourseDialogFragment.java

  21 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  getDialog().setTitle(getString(R.string.edit_course_dialog_fragment_title));
  View result=super.onCreateView(inflater,container,savedInstanceState);
  final EditText nameTextEdit=(EditText)result.findViewById(R.id.add_course_dialog_fragment_name_edit_text);
  final RadioButton pointTotalRadioButton=(RadioButton)result.findViewById(R.id.add_course_dialog_fragment_point_total_radio_button);
  final RadioButton percentageRadioButton=(RadioButton)result.findViewById(R.id.add_course_dialog_fragment_percentage_radio_button);
  nameTextEdit.setText(mCourse.getName());
  if (mCourse.getCourseType() == CourseType.POINT_TOTAL) {
    pointTotalRadioButton.setChecked(true);
  }
 else {
    percentageRadioButton.setChecked(true);
  }
  Button saveButton=(Button)result.findViewById(R.id.add_course_dialog_fragment_create_button);
  saveButton.setText(getString(R.string.edit_course_dialog_fragment_save_course_button));
  saveButton.setEnabled(true);
  saveButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      mCourse.setName(nameTextEdit.getText().toString());
      if (pointTotalRadioButton.isChecked()) {
        mCourse.setCourseType(CourseType.POINT_TOTAL);
      }
 else {
        mCourse.setCourseType(CourseType.PERCENTAGE_WEIGHTING);
      }
      mCourse.save();
      dismiss();
      mOnCoursesChangedListener.onCoursesChanged();
    }
  }
);
  return result;
}
 

Example 17

From project maven-android-plugin-samples, under directory /apidemos-android-10/application/src/main/java/com/example/android/apis/view/.

Source file: RadioGroup1.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.radio_group_1);
  mRadioGroup=(RadioGroup)findViewById(R.id.menu);
  RadioButton newRadioButton=new RadioButton(this);
  newRadioButton.setText(R.string.radio_group_snack);
  newRadioButton.setId(R.id.snack);
  LinearLayout.LayoutParams layoutParams=new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT,RadioGroup.LayoutParams.WRAP_CONTENT);
  mRadioGroup.addView(newRadioButton,0,layoutParams);
  String selection=getString(R.string.radio_group_selection);
  mRadioGroup.setOnCheckedChangeListener(this);
  mChoice=(TextView)findViewById(R.id.choice);
  mChoice.setText(selection + mRadioGroup.getCheckedRadioButtonId());
  Button clearButton=(Button)findViewById(R.id.clear);
  clearButton.setOnClickListener(this);
}
 

Example 18

From project MobiPerf, under directory /android/src/com/mobiperf/speedometer/.

Source file: MeasurementCreationActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.measurement_creation_main);
  assert(this.getParent().getClass().getName().compareTo("SpeedometerApp") == 0);
  this.parent=(SpeedometerApp)this.getParent();
  Spinner spinner=(Spinner)findViewById(R.id.measurementTypeSpinner);
  spinnerValues=new ArrayAdapter<String>(this.getApplicationContext(),R.layout.spinner_layout);
  for (  String name : MeasurementTask.getMeasurementNames()) {
    spinnerValues.add(name);
  }
  spinnerValues.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(spinnerValues);
  spinner.setOnItemSelectedListener(new MeasurementTypeOnItemSelectedListener());
  spinner.requestFocus();
  Button runButton=(Button)this.findViewById(R.id.runTaskButton);
  runButton.setOnClickListener(new ButtonOnClickListener());
  this.measurementTypeUnderEdit=PingTask.TYPE;
  setupEditTextFocusChangeListener();
  this.udpDir="Up";
  final RadioButton radioUp=(RadioButton)findViewById(R.id.UDPBurstUpButton);
  final RadioButton radioDown=(RadioButton)findViewById(R.id.UDPBurstDownButton);
  radioUp.setChecked(true);
  radioUp.setOnClickListener(new RadioOnClickListener());
  radioDown.setOnClickListener(new RadioOnClickListener());
}
 

Example 19

From project rapidandroid, under directory /rapidandroid/org.rapidandroid/src/org/rapidandroid/activity/.

Source file: Dashboard.java

  21 
vote

public void onClick(View v){
  RadioButton buttonView=(RadioButton)v;
  if (buttonView.equals(rb100)) {
    mListCount=100;
    rb100.setChecked(true);
    rb500.setChecked(false);
    rball.setChecked(false);
  }
 else   if (buttonView.equals(rb500)) {
    mListCount=500;
    rb100.setChecked(false);
    rb500.setChecked(true);
    rball.setChecked(false);
  }
 else   if (buttonView.equals(rball)) {
    mListCount=SHOW_ALL;
    rb100.setChecked(false);
    rb500.setChecked(false);
    rball.setChecked(true);
  }
  if (!mIsInitializing) {
    resetCursor=true;
    beginListViewReload();
  }
}
 

Example 20

From project roman10-android-tutorial, under directory /customizedradiobuttonlist/src/roman10/tutorial/customizedradiobuttonlist/.

Source file: RadioGroup1.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.radio_group_1);
  mRadioGroup=(RadioGroup)findViewById(R.id.menu);
  RadioButton newRadioButton=new RadioButton(this);
  newRadioButton.setText("test");
  newRadioButton.setId(R.id.snack);
  LinearLayout.LayoutParams layoutParams=new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT,RadioGroup.LayoutParams.WRAP_CONTENT);
  mRadioGroup.addView(newRadioButton,0,layoutParams);
  mRadioGroup.setOnCheckedChangeListener(this);
  mChoice=(TextView)findViewById(R.id.choice);
  mChoice.setText("selected" + mRadioGroup.getCheckedRadioButtonId());
  Button clearButton=(Button)findViewById(R.id.clear);
  clearButton.setOnClickListener(this);
}
 

Example 21

From project Speedometer, under directory /android/src/com/google/wireless/speed/speedometer/.

Source file: MeasurementCreationActivity.java

  21 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.measurement_creation_main);
  assert(this.getParent().getClass().getName().compareTo("SpeedometerApp") == 0);
  this.parent=(SpeedometerApp)this.getParent();
  Spinner spinner=(Spinner)findViewById(R.id.measurementTypeSpinner);
  spinnerValues=new ArrayAdapter<String>(this.getApplicationContext(),R.layout.spinner_layout);
  for (  String name : MeasurementTask.getMeasurementNames()) {
    spinnerValues.add(name);
  }
  spinnerValues.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(spinnerValues);
  spinner.setOnItemSelectedListener(new MeasurementTypeOnItemSelectedListener());
  spinner.requestFocus();
  Button runButton=(Button)this.findViewById(R.id.runTaskButton);
  runButton.setOnClickListener(new ButtonOnClickListener());
  this.measurementTypeUnderEdit=PingTask.TYPE;
  setupEditTextFocusChangeListener();
  this.udpDir="Up";
  final RadioButton radioUp=(RadioButton)findViewById(R.id.UDPBurstUpButton);
  final RadioButton radioDown=(RadioButton)findViewById(R.id.UDPBurstDownButton);
  radioUp.setChecked(true);
  radioUp.setOnClickListener(new RadioOnClickListener());
  radioDown.setOnClickListener(new RadioOnClickListener());
}
 

Example 22

From project sthlmtraveling, under directory /src/com/markupartist/sthlmtraveling/.

Source file: DeparturesActivity.java

  21 
vote

public void setupFilterButtons(){
  RadioButton radioMetros=(RadioButton)findViewById(R.id.radio_metros);
  radioMetros.setOnCheckedChangeListener(mOnTransportModeChange);
  radioMetros.setEnabled(true);
  radioMetros.setChecked(mPreferredTrafficMode == TransportMode.METRO_INDEX ? true : false);
  RadioButton radioBuses=(RadioButton)findViewById(R.id.radio_buses);
  radioBuses.setOnCheckedChangeListener(mOnTransportModeChange);
  radioBuses.setEnabled(true);
  radioBuses.setChecked(mPreferredTrafficMode == TransportMode.BUS_INDEX ? true : false);
  RadioButton radioTrains=(RadioButton)findViewById(R.id.radio_trains);
  radioTrains.setOnCheckedChangeListener(mOnTransportModeChange);
  radioTrains.setEnabled(true);
  radioTrains.setChecked(mPreferredTrafficMode == TransportMode.TRAIN_INDEX ? true : false);
  RadioButton radioTrams=(RadioButton)findViewById(R.id.radio_trams);
  radioTrams.setOnCheckedChangeListener(mOnTransportModeChange);
  radioTrams.setEnabled(true);
  radioTrams.setChecked(mPreferredTrafficMode == TransportMode.LOKALBANA_INDEX ? true : false);
}
 

Example 23

From project ti5x_android, under directory /src/.

Source file: Main.java

  21 
vote

@Override public void onCreate(android.os.Bundle savedInstanceState){
  setTitle(R.string.button_feedback);
  final android.widget.LinearLayout MainLayout=new android.widget.LinearLayout(ctx);
  MainLayout.setOrientation(android.widget.LinearLayout.VERTICAL);
  setContentView(MainLayout);
  TheButtons=new android.widget.RadioGroup(ctx);
  final ViewGroup.LayoutParams ButtonLayout=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
{
    final RadioButton FeedbackClick=new RadioButton(ctx);
    FeedbackClick.setText(R.string.click);
    FeedbackClick.setId(ButtonGrid.FEEDBACK_CLICK);
    final RadioButton FeedbackVibrate=new RadioButton(ctx);
    FeedbackVibrate.setText(R.string.vibrate);
    FeedbackVibrate.setId(ButtonGrid.FEEDBACK_VIBRATE);
    final RadioButton FeedbackNone=new RadioButton(ctx);
    FeedbackNone.setText(R.string.none);
    FeedbackNone.setId(ButtonGrid.FEEDBACK_NONE);
    TheButtons.addView(FeedbackClick,0,ButtonLayout);
    TheButtons.addView(FeedbackVibrate,1,ButtonLayout);
    TheButtons.addView(FeedbackNone,2,ButtonLayout);
  }
  MainLayout.addView(TheButtons,ButtonLayout);
  TheButtons.check(Global.Buttons.FeedbackType);
  setOnDismissListener(this);
}
 

Example 24

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AAWidget.java

  19 
vote

/** 
 * Creates the activity; This themes up our activity to look like a dialog Also registers some UI action listeners to the UI elements
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.widget_settings);
  this.setTitle("Widget Settings");
  getWindow().setBackgroundDrawableResource(R.drawable.widget_dialog2);
  Display d=getWindow().getWindowManager().getDefaultDisplay();
  getWindow().setLayout(d.getWidth() * 15 / 16,LayoutParams.WRAP_CONTENT);
  this.setResult(RESULT_CANCELED);
  settings=this.getSharedPreferences("settings",0);
  btn_ok=(Button)this.findViewById(R.id.btn_ok);
  sb_freq=(SeekBar)this.findViewById(R.id.sb_freq);
  tv_freq=(TextView)this.findViewById(R.id.tv_freq);
  rg_layoutPicker=(RadioGroup)this.findViewById(R.id.rg_layoutPicker);
  rb_left=(RadioButton)this.findViewById(R.id.rb_left);
  rb_center=(RadioButton)this.findViewById(R.id.rb_center);
  btn_ok.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      acceptChanges();
    }
  }
);
  sb_freq.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
    @Override public void onStopTrackingTouch(    SeekBar seekBar){
    }
    @Override public void onStartTrackingTouch(    SeekBar seekBar){
    }
    /** 
 * When the user changes the position of the slider bar; display  the current progress in the textview below
 */
    @Override public void onProgressChanged(    SeekBar seekBar,    int progress,    boolean fromUser){
      tv_freq.setText((progress + 1) + " hour/s");
    }
  }
);
  sb_freq.setProgress((int)settings.getLong("freq",2) - 1);
}
 

Example 25

From project android-context, under directory /defunct/.

Source file: ContextViewHolder.java

  19 
vote

public ContextViewHolder(View base){
  this.rb1=(RadioButton)base.findViewById(R.id.radioYes);
  this.rb2=(RadioButton)base.findViewById(R.id.radioNo);
  this.contextText=(TextView)base.findViewById(R.id.currentContext);
  if (rb1.isChecked() == true) {
    accurate=true;
  }
 else   if (rb2.isChecked() == true) {
    accurate=false;
  }
}
 

Example 26

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/dialogs/.

Source file: CreateGifSettingsDialog.java

  19 
vote

private void setInitialValues(){
  int sizeRadioId;
switch (GSSettings.getGifOutputSize()) {
case LARGE:
    sizeRadioId=R.id.radio_img_large;
  break;
case MEDIUM:
sizeRadioId=R.id.radio_img_med;
break;
default :
sizeRadioId=R.id.radio_img_small;
}
((RadioButton)this.findViewById(sizeRadioId)).setChecked(true);
this.mFrameDelaySeekBar.setProgress(this.convertRealValueToSBValue(GSSettings.getGifFrameDelay()));
this.setFrameDelayTextValue(this.convertSBValueToRealValue(this.mFrameDelaySeekBar.getProgress()));
}
 

Example 27

From project AndroidLab, under directory /src/src/de/tubs/ibr/android/ldap/core/activities/.

Source file: ConflictActivity.java

  19 
vote

private void showContact(int rawcontactid){
  setContentView(R.layout.conflict_view);
  Bundle localcontact=ContactManager.loadContact(rawcontactid,this);
  Bundle remotecontact=loadRemoteContact(localcontact.getString(AttributeMapper.ATTR_UID));
  Bundle lastSyncedContact=loadLastSyncedContact(localcontact);
  localcontact=ContactManager.createMapableBundle(localcontact);
  this.setTitle("Conflict of " + localcontact.getString(AttributeMapper.FULL_NAME));
  Set<String> conflictKeys=new LinkedHashSet<String>();
  Bundle mergeresult=new Bundle();
  ContactManager.mergeBundle(localcontact,remotecontact,lastSyncedContact,mergeresult,conflictKeys);
  adapter=new SimpleAdapter(this,list,R.layout.conflict_row,new String[]{"Value1","Value2","Key"},new int[]{R.id.value1,R.id.value2,R.id.key});
  setListAdapter(adapter);
  for (  String key : conflictKeys) {
    addConflictItem(key,localcontact.getString(key),remotecontact.getString(key));
  }
  rb1=(RadioButton)findViewById(R.id.selector1);
  rb2=(RadioButton)findViewById(R.id.selector2);
}
 

Example 28

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: OnScreenSettings.java

  19 
vote

public View getView(int position,View convertView,ViewGroup parent){
  CharSequence entry[]=mPreference.getEntries();
  if (position == 0) {
    convertView=inflateIfNeed(convertView,R.layout.on_screen_menu_header,parent,false);
    ((TextView)convertView.findViewById(R.id.title)).setText(mPreference.getDialogTitle());
  }
 else {
    int index=position - 1;
    convertView=inflateIfNeed(convertView,R.layout.on_screen_submenu_item,parent,false);
    boolean checked=mPreference.getValue().equals(mPreference.getEntryValues()[index]);
    ((TextView)convertView.findViewById(R.id.title)).setText(entry[index]);
    ((RadioButton)convertView.findViewById(R.id.radio_button)).setChecked(checked);
    ImageView icon=(ImageView)convertView.findViewById(R.id.icon);
    if (mIconPreference != null) {
      icon.setVisibility(View.VISIBLE);
      icon.setImageDrawable(mIconPreference.getIcons()[position - 1]);
    }
 else {
      icon.setVisibility(View.GONE);
    }
  }
  return convertView;
}
 

Example 29

From project apg, under directory /src/org/thialfihar/android/apg/ui/widget/.

Source file: UserIdEditor.java

  19 
vote

@Override protected void onFinishInflate(){
  setDrawingCacheEnabled(true);
  setAlwaysDrawnWithCacheEnabled(true);
  mDeleteButton=(ImageButton)findViewById(R.id.delete);
  mDeleteButton.setOnClickListener(this);
  mIsMainUserId=(RadioButton)findViewById(R.id.isMainUserId);
  mIsMainUserId.setOnClickListener(this);
  mName=(EditText)findViewById(R.id.name);
  mEmail=(EditText)findViewById(R.id.email);
  mComment=(EditText)findViewById(R.id.comment);
  super.onFinishInflate();
}
 

Example 30

From project apps-for-android, under directory /RingsExtended/src/com/example/android/rings_extended/.

Source file: MusicPicker.java

  19 
vote

@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  View v=super.newView(context,cursor,parent);
  ViewHolder vh=new ViewHolder();
  vh.line1=(TextView)v.findViewById(R.id.line1);
  vh.line2=(TextView)v.findViewById(R.id.line2);
  vh.duration=(TextView)v.findViewById(R.id.duration);
  vh.radio=(RadioButton)v.findViewById(R.id.radio);
  vh.play_indicator=(ImageView)v.findViewById(R.id.play_indicator);
  vh.buffer1=new CharArrayBuffer(100);
  vh.buffer2=new char[200];
  v.setTag(vh);
  return v;
}
 

Example 31

From project CHMI, under directory /src/org/kaldax/app/chmi/.

Source file: AppConfigurationActivity.java

  19 
vote

private void setRadioBtPropsWifi(RadioButton bt,int iNumber,OnClickListener click,RadioGroup grImgCount){
  grImgCount.addView(bt);
  bt.setText(new Integer(iNumber).toString());
  bt.setTag(new Integer(iNumber));
  bt.setChecked(chmiConfigBundlel._images_count_wifi == iNumber);
  bt.setOnClickListener(click);
}
 

Example 32

From project gobandroid, under directory /src/org/ligi/gobandroid_hd/ui/gnugo/.

Source file: GnuGoSetupDialog.java

  19 
vote

public GnuGoSetupDialog(Context context){
  super(context);
  shared_prefs=PreferenceManager.getDefaultSharedPreferences(context);
  setTitle(R.string.gnugo);
  setIconResource(R.drawable.preferences);
  setContentFill();
  setContentView(R.layout.setup_gnugo);
  gnugo_plays_white_radio=(RadioButton)this.findViewById(R.id.gnugo_plays_white_radio);
  gnugo_plays_black_radio=(RadioButton)this.findViewById(R.id.gnugo_plays_black_radio);
  gnugo_plays_both_radio=(RadioButton)this.findViewById(R.id.gnugo_plays_both_radio);
  if (shared_prefs.getBoolean(SP_KEY_PLAYS_BOTH,false))   gnugo_plays_both_radio.setChecked(true);
 else   if (shared_prefs.getBoolean(SP_KEY_PLAYS_WHITE,false))   gnugo_plays_white_radio.setChecked(true);
 else   if (shared_prefs.getBoolean(SP_KEY_PLAYS_BLACK,false))   gnugo_plays_black_radio.setChecked(true);
 else   gnugo_plays_black_radio.setChecked(true);
  strange_seek=((SeekBar)this.findViewById(R.id.gnugo_strength_seek));
  strange_seek.setProgress(shared_prefs.getInt(SP_KEY_STRENGTH,0));
}
 

Example 33

From project NFCShopping, under directory /mobile phone client/NFCShopping/src/scut/bgooo/ui/.

Source file: RegisterActivity.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.register);
  mUserName=(EditText)findViewById(R.id.reuser);
  mUserPassword=(EditText)findViewById(R.id.repassword1);
  mUserRepeatPassword=(EditText)findViewById(R.id.repassword2);
  mFemale=(RadioButton)findViewById(R.id.female);
  mMale=(RadioButton)findViewById(R.id.male);
  mOther=(RadioButton)findViewById(R.id.other);
  mGenderChooser=(RadioGroup)findViewById(R.id.radioGroup_gender);
  mGenderChooser.setOnCheckedChangeListener(onCheckedChangeListener);
  mConfirm=(Button)findViewById(R.id.reconfirm);
  mCancle=(Button)findViewById(R.id.recancle);
  mConfirm.setOnClickListener(onClickListener);
  mCancle.setOnClickListener(onClickListener);
}
 

Example 34

From project ohmagePhone, under directory /src/org/ohmage/fragments/.

Source file: MobilityControlFragment.java

  19 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.mobility_control_layout,container,false);
  mMobilityList=(ListView)view.findViewById(R.id.mobility_list);
  mTotalCountText=(TextView)view.findViewById(R.id.mobility_total);
  mUploadCountText=(TextView)view.findViewById(R.id.mobility_count);
  mLastUploadText=(TextView)view.findViewById(R.id.last_upload);
  mUploadButton=(Button)view.findViewById(R.id.upload_button);
  mOffRadio=(RadioButton)view.findViewById(R.id.radio_off);
  mInterval1Radio=(RadioButton)view.findViewById(R.id.radio_1min);
  mInterval5Radio=(RadioButton)view.findViewById(R.id.radio_5min);
  TextView emptyView=(TextView)view.findViewById(R.id.empty);
  mMobilityList.setEmptyView(emptyView);
  String[] from=new String[]{MobilityInterface.KEY_MODE,MobilityInterface.KEY_TIME};
  int[] to=new int[]{R.id.text1,R.id.text2};
  mAdapter=new SimpleCursorAdapter(getActivity(),R.layout.mobility_list_item,null,from,to,0);
  mAdapter.setViewBinder(new SimpleCursorAdapter.ViewBinder(){
    @Override public boolean setViewValue(    View view,    Cursor cursor,    int columnIndex){
switch (view.getId()) {
case R.id.text1:
        ((TextView)view).setText(cursor.getString(columnIndex));
      return true;
case R.id.text2:
    long time=cursor.getLong(columnIndex);
  ((TextView)view).setText(DateFormat.format("h:mmaa",time));
return true;
}
return false;
}
}
);
mMobilityList.setAdapter(mAdapter);
mTotalCountText.setText(emptyValue);
mUploadCountText.setText(emptyValue);
mOffRadio.setChecked(true);
mUploadButton.setOnClickListener(mUploadListener);
return view;
}
 

Example 35

From project open311-android, under directory /open311-android/src/gov/in/bloomington/georeporter/adapters/.

Source file: ServersAdapter.java

  19 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder holder;
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.list_item_servers,null);
    holder=new ViewHolder();
    holder.name=(TextView)convertView.findViewById(android.R.id.text1);
    holder.url=(TextView)convertView.findViewById(android.R.id.text2);
    holder.radio=(RadioButton)convertView.findViewById(R.id.radio);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  String name=mServers.optJSONObject(position).optString(Open311.NAME);
  String url=mServers.optJSONObject(position).optString(Open311.URL);
  if (name.equals(mCurrentServerName)) {
    holder.radio.setChecked(true);
  }
 else {
    holder.radio.setChecked(false);
  }
  holder.name.setText(name);
  holder.url.setText(url);
  return convertView;
}
 

Example 36

From project packages_apps_Calendar, under directory /src/com/android/calendar/event/.

Source file: EditEventView.java

  19 
vote

private void addFieldsRecursive(StringBuilder b,View v){
  if (v == null || v.getVisibility() != View.VISIBLE) {
    return;
  }
  if (v instanceof TextView) {
    CharSequence tv=((TextView)v).getText();
    if (!TextUtils.isEmpty(tv.toString().trim())) {
      b.append(tv + PERIOD_SPACE);
    }
  }
 else   if (v instanceof RadioGroup) {
    RadioGroup rg=(RadioGroup)v;
    int id=rg.getCheckedRadioButtonId();
    if (id != View.NO_ID) {
      b.append(((RadioButton)(v.findViewById(id))).getText() + PERIOD_SPACE);
    }
  }
 else   if (v instanceof Spinner) {
    Spinner s=(Spinner)v;
    if (s.getSelectedItem() instanceof String) {
      String str=((String)(s.getSelectedItem())).trim();
      if (!TextUtils.isEmpty(str)) {
        b.append(str + PERIOD_SPACE);
      }
    }
  }
 else   if (v instanceof ViewGroup) {
    ViewGroup vg=(ViewGroup)v;
    int children=vg.getChildCount();
    for (int i=0; i < children; i++) {
      addFieldsRecursive(b,vg.getChildAt(i));
    }
  }
}
 

Example 37

From project platform_packages_apps_calendar, under directory /src/com/android/calendar/event/.

Source file: EditEventView.java

  19 
vote

private void addFieldsRecursive(StringBuilder b,View v){
  if (v == null || v.getVisibility() != View.VISIBLE) {
    return;
  }
  if (v instanceof TextView) {
    CharSequence tv=((TextView)v).getText();
    if (!TextUtils.isEmpty(tv.toString().trim())) {
      b.append(tv + PERIOD_SPACE);
    }
  }
 else   if (v instanceof RadioGroup) {
    RadioGroup rg=(RadioGroup)v;
    int id=rg.getCheckedRadioButtonId();
    if (id != View.NO_ID) {
      b.append(((RadioButton)(v.findViewById(id))).getText() + PERIOD_SPACE);
    }
  }
 else   if (v instanceof Spinner) {
    Spinner s=(Spinner)v;
    if (s.getSelectedItem() instanceof String) {
      String str=((String)(s.getSelectedItem())).trim();
      if (!TextUtils.isEmpty(str)) {
        b.append(str + PERIOD_SPACE);
      }
    }
  }
 else   if (v instanceof ViewGroup) {
    ViewGroup vg=(ViewGroup)v;
    int children=vg.getChildCount();
    for (int i=0; i < children; i++) {
      addFieldsRecursive(b,vg.getChildAt(i));
    }
  }
}
 

Example 38

From project platform_packages_apps_music, under directory /src/com/android/music/.

Source file: MusicPicker.java

  19 
vote

@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  View v=super.newView(context,cursor,parent);
  ViewHolder vh=new ViewHolder();
  vh.line1=(TextView)v.findViewById(R.id.line1);
  vh.line2=(TextView)v.findViewById(R.id.line2);
  vh.duration=(TextView)v.findViewById(R.id.duration);
  vh.radio=(RadioButton)v.findViewById(R.id.radio);
  vh.play_indicator=(ImageView)v.findViewById(R.id.play_indicator);
  vh.buffer1=new CharArrayBuffer(100);
  vh.buffer2=new char[200];
  v.setTag(vh);
  return v;
}
 

Example 39

From project SchoolPlanner4Untis, under directory /src/edu/htl3r/schoolplanner/gui/startup_wizard/.

Source file: StartupWizardIntroduction.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.startup_wizard_introduction);
  initTitle(getResources().getString(R.string.startup_wizard_header));
  expert=(RadioButton)findViewById(R.id.swi_radio_expert);
  easy=(RadioButton)findViewById(R.id.swi_radio_easy);
  nextButton=(Button)findViewById(R.id.startup_wizard_introduction_next_button);
  nextButton.setOnClickListener(new Button.OnClickListener(){
    @Override public void onClick(    View v){
      if (expert.isChecked())       startActivity(new Intent(thisActivity,StartupWizardLoginInformationExpert.class));
      if (easy.isChecked())       startActivity(new Intent(thisActivity,StartupWizardLoginInformationEasyServerUrl.class));
    }
  }
);
  backButton=(Button)findViewById(R.id.startup_wizard_introduction_back_button);
  backButton.setOnClickListener(new Button.OnClickListener(){
    @Override public void onClick(    View v){
      finish();
    }
  }
);
}
 

Example 40

From project SeriesGuide, under directory /SeriesGuide/src/com/battlelancer/seriesguide/appwidget/.

Source file: ListWidgetConfigure.java

  19 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setTheme(SeriesGuidePreferences.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.listwidget_configure);
  setResult(RESULT_CANCELED);
  findViewById(R.id.buttonConfigDone).setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      onSetupWidget();
    }
  }
);
  mRadioGroupType=(RadioGroup)findViewById(R.id.radioGroupListType);
  mRadioGroupType.check(R.id.radioUpcoming);
  mRadioButtonRecent=(RadioButton)findViewById(R.id.radioRecent);
  mCheckUnwatched=(CheckBox)findViewById(R.id.checkBoxUnwatched);
  if (!Utils.isSupporterChannel(this)) {
    mRadioButtonRecent.setEnabled(false);
    mRadioButtonRecent.setText(getString(R.string.recent) + " (" + getString(R.string.onlyx)+ ")");
  }
  Intent intent=getIntent();
  Bundle extras=intent.getExtras();
  if (extras != null) {
    mAppWidgetId=extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  }
  if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
    finish();
  }
}
 

Example 41

From project SWE12-Drone, under directory /catroid/src/at/tugraz/ist/catroid/plugin/Drone/other/.

Source file: DroneMoveBrickChooseMovementDialog.java

  19 
vote

public DroneMoveBrickChooseMovementDialog(Context context,boolean options[]){
  super(context);
  this.options=options;
  this.radioButton=new RadioButton[options.length];
  this.radioGroup=new RadioGroup[options.length / 2];
  this.hack=new boolean[options.length / 2];
}
 

Example 42

From project twidere, under directory /src/org/mariotaku/twidere/activity/.

Source file: EditAPIActivity.java

  19 
vote

@Override public void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.edit_api);
  mEditRestBaseURL=(EditText)findViewById(R.id.rest_base_url);
  mEditAuthType=(RadioGroup)findViewById(R.id.auth_type);
  mButtonOAuth=(RadioButton)findViewById(R.id.oauth);
  mButtonxAuth=(RadioButton)findViewById(R.id.xauth);
  mButtonBasic=(RadioButton)findViewById(R.id.basic);
  mButtonTwipOMode=(RadioButton)findViewById(R.id.twip_o);
  mAdvancedAPIConfigLabel=(TextView)findViewById(R.id.advanced_api_config_label);
  mSaveButton=(Button)findViewById(R.id.save);
  Bundle bundle=savedInstanceState == null ? getIntent().getExtras() : savedInstanceState;
  if (bundle == null) {
    bundle=new Bundle();
  }
  mRestBaseURL=bundle.getString(Accounts.REST_BASE_URL);
  mSigningRESTBaseURL=bundle.getString(Accounts.SIGNING_REST_BASE_URL);
  mOAuthBaseURL=bundle.getString(Accounts.OAUTH_BASE_URL);
  mSigningOAuthBaseURL=bundle.getString(Accounts.SIGNING_OAUTH_BASE_URL);
  mAuthType=bundle.getInt(Accounts.AUTH_TYPE);
  mEditAuthType.setOnCheckedChangeListener(this);
  mAdvancedAPIConfigLabel.setOnClickListener(this);
  mSaveButton.setOnClickListener(this);
  mEditRestBaseURL.setText(mRestBaseURL != null ? mRestBaseURL : DEFAULT_REST_BASE_URL);
  mButtonOAuth.setChecked(mAuthType == Accounts.AUTH_TYPE_OAUTH);
  mButtonxAuth.setChecked(mAuthType == Accounts.AUTH_TYPE_XAUTH);
  mButtonBasic.setChecked(mAuthType == Accounts.AUTH_TYPE_BASIC);
  mButtonTwipOMode.setChecked(mAuthType == Accounts.AUTH_TYPE_TWIP_O_MODE);
}
 

Example 43

From project UABDroid, under directory /src/org/uab/deic/uabdroid/.

Source file: ExaminationActivity.java

  19 
vote

/** 
 * TODO
 */
public boolean loadQuestion(int _numOfQuestionToLoad){
  try {
    String locale=Locale.getDefault().toString();
    Examination questionAndAnswers=mExamList.get(_numOfQuestionToLoad);
    mTextViewQuestionTitle.setText(getResources().getString(R.string.examination_question_title) + " " + (_numOfQuestionToLoad + 1));
    if (locale.compareTo("ca_ES") == 0) {
      mTextViewQuestion.setText(questionAndAnswers.getQuestion("ca_ES"));
    }
 else {
      mTextViewQuestion.setText(questionAndAnswers.getQuestion("es_ES"));
    }
    mRadioGroupAnswers.clearCheck();
    for (int i=0; i < mRadioGroupAnswers.getChildCount(); i++) {
      ((RadioButton)mRadioGroupAnswers.getChildAt(i)).setText(questionAndAnswers.getAnswer(i));
    }
    mNumberOfQuestionLoaded=_numOfQuestionToLoad;
  }
 catch (  Exception e) {
    return false;
  }
  return true;
}
 

Example 44

From project xinkvpn, under directory /main/src/activity/xink/vpn/.

Source file: VpnSettings.java

  19 
vote

@Override public boolean setViewValue(final View view,final Object data,final String textRepresentation){
  if (!(data instanceof VpnViewItem))   return false;
  VpnViewItem item=(VpnViewItem)data;
  boolean bound=true;
  if (view instanceof RadioButton) {
    bindVpnItem((RadioButton)view,item);
  }
 else   if (view instanceof ToggleButton) {
    bindVpnState((ToggleButton)view,item);
  }
 else   if (view instanceof TextView) {
    bindVpnStateMsg(((TextView)view),item);
  }
 else {
    bound=false;
    Log.d(TAG,"unknown view, not bound: v=" + view + ", data="+ textRepresentation);
  }
  return bound;
}