List of usage examples for android.widget RadioButton setChecked
@Override public void setChecked(boolean checked)
Changes the checked state of this button.
From source file:com.akop.bach.fragment.playstation.GameCatalogFilterFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater li = getActivity().getLayoutInflater(); View layout = li.inflate(R.layout.psn_fragment_catalog_filter, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setView(layout) .setTitle(R.string.catalog_filter_u) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mAccount.setCatalogConsole(mConsole); mAccount.setCatalogReleaseStatus(mReleaseStatus); mAccount.setCatalogSortOrder(mSortOrder); mAccount.save(Preferences.get(getActivity())); if (mOkListener != null) mOkListener.okClicked(mConsole, mReleaseStatus, mSortOrder); dismiss();//from ww w . ja v a2 s .c o m } }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dismiss(); } }); RadioButton btn; btn = (RadioButton) layout.findViewById(R.id.filter_order_alpha); btn.setChecked(mSortOrder == PSN.CATALOG_SORT_BY_ALPHA); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mSortOrder = PSN.CATALOG_SORT_BY_ALPHA; } }); btn = (RadioButton) layout.findViewById(R.id.filter_order_reldate); btn.setChecked(mSortOrder == PSN.CATALOG_SORT_BY_RELEASE); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mSortOrder = PSN.CATALOG_SORT_BY_RELEASE; } }); btn = (RadioButton) layout.findViewById(R.id.filter_rs_coming_soon); btn.setChecked(mReleaseStatus == PSN.CATALOG_RELEASE_COMING_SOON); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mReleaseStatus = PSN.CATALOG_RELEASE_COMING_SOON; } }); btn = (RadioButton) layout.findViewById(R.id.filter_rs_out_now); btn.setChecked(mReleaseStatus == PSN.CATALOG_RELEASE_OUT_NOW); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mReleaseStatus = PSN.CATALOG_RELEASE_OUT_NOW; } }); Spinner spin = (Spinner) layout.findViewById(R.id.filter_console); spin.setSelection(mConsole); spin.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { mConsole = arg2; } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); View view = layout.findViewById(R.id.filter_rs); view.setVisibility(mAccount.supportsFilteringByReleaseDate() ? View.VISIBLE : View.GONE); return builder.create(); }
From source file:com.numenta.taurus.instance.InstanceListActivity.java
@Override public void onBackPressed() { if (_favorites.getCheckedRadioButtonId() == R.id.filter_favorites) { clearNotifications();//from www .j ava 2s.c o m RadioButton b = (RadioButton) _favorites.findViewById(R.id.filter_none); b.setChecked(true); } else { super.onBackPressed(); } }
From source file:com.numenta.taurus.instance.InstanceListActivity.java
/** * If the activity was started with an intent, such as {@link Intent#ACTION_SEARCH}, * perform the action expressed in the intent. * * @param intent The intent to process/*from w ww .jav a 2 s.co m*/ * @see Intent#ACTION_SEARCH */ private void handleIntent(@NonNull Intent intent) { // Handle "Search" intents if (Intent.ACTION_SEARCH.equals(intent.getAction())) { // SearchManager.QUERY is the key that a SearchManager will use to send a query string // to an Activity. String query = intent.getStringExtra(SearchManager.QUERY); _listFragment.applyFilter(query); } if (TaurusApplication.ACTION_SHOW_NOTIFICATION_LIST.equals(intent.getAction())) { clearNotifications(); if (_favorites.getCheckedRadioButtonId() == R.id.filter_none) { RadioButton b = (RadioButton) _favorites.findViewById(R.id.filter_favorites); b.setChecked(true); } } }
From source file:com.hardcopy.vcontroller.fragments.ControllerFragment.java
private void restoreUserInput(boolean getFromPref) { if (getFromPref) { mUserInput = Settings.getInstance(mContext).getCommandSettings(); }//from w w w . j av a2s. co m String topic = mUserInput.getString(Constants.topic, Constants.empty); mEditTopic.setText(topic); RadioButton wRadio = (RadioButton) mRadioQos .getChildAt(mUserInput.getInt(Constants.qos, Constants.defaultQos)); wRadio.setChecked(true); mCheckRetained.setChecked(mUserInput.getBoolean(Constants.retained, Constants.defaultRetained)); }
From source file:it.andreascarpino.forvodroid.SettingsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.settings, container, false); SharedPreferences preferences = getActivity().getSharedPreferences(MainActivity.CONFIG_FILE, Context.MODE_PRIVATE); EditText apiKey = (EditText) rootView.findViewById(R.id.api_key); String key = preferences.getString(MainActivity.CONFIG_API_KEY, ""); if (key.length() > 0) { apiKey.setText(key);/* w w w . j a va 2 s . c om*/ } EditText languages = (EditText) rootView.findViewById(R.id.languages); String langs = preferences.getString(MainActivity.CONFIG_LANGUAGES, ""); if (langs.length() > 0) { languages.setText(langs); } // By default use OGG final RadioButton ogg = (RadioButton) rootView.findViewById(R.id.ogg); final RadioButton mp3 = (RadioButton) rootView.findViewById(R.id.mp3); ogg.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mp3.setChecked(!isChecked); } }); mp3.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { ogg.setChecked(!isChecked); } }); boolean oggEnabled = preferences.getBoolean(MainActivity.CONFIG_OGG, true); ogg.setChecked(oggEnabled); if (oggEnabled) { mp3.setChecked(false); } else { mp3.setChecked(true); } return rootView; }
From source file:com.numenta.taurus.instance.InstanceListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); // Create content from resource setContentView(R.layout.activity_instance_list); // Get ListFragment _listFragment = (InstanceListFragment) getFragmentManager().findFragmentById(R.id.instance_list_fragment); // Add Filter menu ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.actionbar_filter); _favorites = (RadioGroup) actionBar.getCustomView().findViewById(R.id.filter); if (_favorites != null) { _favorites.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override/*from w w w . j a va2 s . c om*/ public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.filter_favorites) { clearNotifications(); _listFragment.filterFavorites(); } else { _listFragment.clearFilter(); } // Write the new viewState to the preferences pref.edit().putInt(TaurusPreferenceConstants.PREF_LAST_VIEW_STATE, checkedId).apply(); } }); int checkedId = R.id.filter_none; try { checkedId = pref.getInt(TaurusPreferenceConstants.PREF_LAST_VIEW_STATE, R.id.filter_none); } catch (ClassCastException e) { // Remove old preference value pref.edit().remove(TaurusPreferenceConstants.PREF_LAST_VIEW_STATE).apply(); } RadioButton button = (RadioButton) _favorites.findViewById(checkedId); if (button != null) { button.setChecked(true); } } } // Handle search queries if (getIntent() != null) { handleIntent(getIntent()); } // Check if we should show the tutorial page boolean skipTutorial = pref.getBoolean(PreferencesConstants.PREF_SKIP_TUTORIAL, false); if (!skipTutorial) { Intent myIntent = new Intent(this, TutorialActivity.class); startActivity(myIntent); overridePendingTransition(0, R.anim.fadeout_animation); } }
From source file:com.hardcopy.vcontroller.fragments.HistoryFragment.java
private void restoreUserInput() { String topic = mUserInput.getString(Constants.topic, Constants.empty); mEditTopic.setText(topic);//www . j av a 2s .c om String message = mUserInput.getString(Constants.message, Constants.empty); mEditMessage.setText(message); RadioButton wRadio = (RadioButton) mRadioQos .getChildAt(mUserInput.getInt(Constants.qos, Constants.defaultQos)); wRadio.setChecked(true); mCheckRetained.setChecked(mUserInput.getBoolean(Constants.retained, Constants.defaultRetained)); }
From source file:com.nxp.nfc_demo.fragments.NdefFragment.java
public void onClick(View v) { switch (v.getId()) { case R.id.readNdefButton: // Reset the values of the view MainActivity.demo.NDEFReadFinish(); ndefPerformance.setText(getResources().getString(R.string.layout_input_ndef_read)); ndefCallback.setText(getResources().getString(R.string.readNdefMsg)); readNdefButton.setBackgroundResource(R.drawable.btn_blue); writeNdefButton.setBackgroundColor(Color.BLACK); ndefWriteOptions.setVisibility(View.GONE); ndefReadType.setVisibility(View.VISIBLE); linearBt.setVisibility(View.GONE); linearSp.setVisibility(View.GONE); ndefEditText.setVisibility(View.GONE); ndefText.setVisibility(View.VISIBLE); ndefReadLoop.setVisibility(View.VISIBLE); writeChosen = false;//from w w w .j a v a 2s .c o m // Read content if (MainActivity.demo.isReady()) { MainActivity.demo.finishAllTasks(); MainActivity.launchNdefDemo(MainActivity.getAuthStatus(), MainActivity.getPassword()); } // Make the writeDefaultButtons and AAR checkbox invisible writeDefaultNdefButton.setVisibility(View.GONE); addAar.setVisibility(View.GONE); break; case R.id.writeNdefButton: // Make the writeDefaultButtons and AAR checkbox visible writeDefaultNdefButton.setVisibility(View.VISIBLE); addAar.setVisibility(View.VISIBLE); ndefPerformance.setText(getResources().getString(R.string.layout_input_ndef_write)); ndefCallback.setText(getResources().getString(R.string.writeNdefMsg)); // Close the ReadNdef Taks MainActivity.demo.NDEFReadFinish(); if (writeChosen == true) { if (MainActivity.demo.isReady()) { MainActivity.demo.finishAllTasks(); MainActivity.launchNdefDemo(MainActivity.getAuthStatus(), MainActivity.getPassword()); } } else { ndefCallback.setText(getResources().getString(R.string.writeNdefMsg)); writeNdefButton.setBackgroundResource(R.drawable.btn_blue); readNdefButton.setBackgroundColor(Color.BLACK); ndefWriteOptions.setVisibility(View.VISIBLE); ndefReadType.setVisibility(View.GONE); ndefReadLoop.setVisibility(View.GONE); if (getNdefType().equals(getResources().getString(R.string.radio_btpair))) { linearBt.setVisibility(View.VISIBLE); linearSp.setVisibility(View.GONE); ndefEditText.setVisibility(View.GONE); } else if (getNdefType().equals(getResources().getString(R.string.radio_sp))) { linearBt.setVisibility(View.GONE); linearSp.setVisibility(View.VISIBLE); ndefEditText.setVisibility(View.GONE); } else { linearBt.setVisibility(View.GONE); linearSp.setVisibility(View.GONE); ndefEditText.setVisibility(View.VISIBLE); } ndefText.setVisibility(View.GONE); writeChosen = true; } break; case R.id.writeDefaultButton: ndefCallback.setText(getResources().getString(R.string.writeNdefMsg)); writeNdefButton.setBackgroundResource(R.drawable.btn_blue); readNdefButton.setBackgroundColor(Color.BLACK); ndefWriteOptions.setVisibility(View.VISIBLE); ndefReadType.setVisibility(View.GONE); RadioButton uri = (RadioButton) ndefWriteOptions.getChildAt(6); uri.setChecked(true); linearSp.setVisibility(View.VISIBLE); linearBt.setVisibility(View.GONE); ndefEditText.setVisibility(View.GONE); ndefEditTitle.setText(getResources().getString(R.string.ndef_default_text)); ndefEditLink.setText(getResources().getString(R.string.ndef_default_uri)); ndefText.setVisibility(View.GONE); addAar.setChecked(true); writeChosen = true; // Write content if (MainActivity.demo.isReady()) { MainActivity.demo.finishAllTasks(); MainActivity.launchNdefDemo(MainActivity.getAuthStatus(), MainActivity.getPassword()); } break; default: break; } }
From source file:com.clevertrail.mobile.findtrail.Activity_FindTrail_ByLocation.java
private void toggleRadiobuttons(boolean bProximity) { RadioButton rbProximity = (RadioButton) findViewById(R.id.rbFindTrailByLocationProximity); rbProximity.setChecked(bProximity); EditText etCity = (EditText) findViewById(R.id.txtFindTrailByLocationCity); etCity.setEnabled(!bProximity);/*from w ww. j a v a 2 s . c o m*/ RadioButton rbCity = (RadioButton) findViewById(R.id.rbFindTrailByLocationCity); rbCity.setChecked(!bProximity); }
From source file:kn.uni.gis.foxhunt.GameActivity.java
private void disableConnectionButton(final int id) { runOnUiThread(new Runnable() { @Override//from w w w.j a v a 2s .c o m public void run() { RadioButton button = ((RadioButton) findViewById(id)); button.setChecked(false); } }); }