Java Code Examples for android.widget.RadioButton#performClick()
The following examples show how to use
android.widget.RadioButton#performClick() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RoutePreviewFragmentTest.java From open with GNU General Public License v3.0 | 5 votes |
@Test public void routeForCar_shouldRouteByCar() throws Exception { RadioButton byCar = (RadioButton) fragment.getView().findViewById(R.id.by_car); byCar.setChecked(false); byCar.performClick(); verify(router, times(2)).setDriving(); }
Example 2
Source File: RoutePreviewFragmentTest.java From open with GNU General Public License v3.0 | 5 votes |
@Test public void byCar_shouldSendMixpanelEvent() throws Exception { RadioButton byCar = (RadioButton) fragment.getView().findViewById(R.id.by_car); byCar.setChecked(false); byCar.performClick(); verify(mixpanelAPI).track(eq(ROUTING_PREVIEW_CAR), any(JSONObject.class)); }
Example 3
Source File: WriteTag.java From MifareClassicTool with GNU General Public License v3.0 | 4 votes |
/** * Initialize the layout and some member variables. If the Intent * contains {@link #EXTRA_DUMP} (and therefore was send from * {@link DumpEditor}), the write dump option will be adjusted * accordingly. */ // It is checked but the IDE don't get it. @SuppressWarnings("unchecked") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_write_tag); mSectorTextBlock = findViewById(R.id.editTextWriteTagSector); mBlockTextBlock = findViewById(R.id.editTextWriteTagBlock); mDataText = findViewById(R.id.editTextWriteTagData); mSectorTextVB = findViewById( R.id.editTextWriteTagValueBlockSector); mBlockTextVB = findViewById( R.id.editTextWriteTagValueBlockBlock); mNewValueTextVB = findViewById( R.id.editTextWriteTagValueBlockValue); mIncreaseVB = findViewById( R.id.radioButtonWriteTagWriteValueBlockIncr); mStaticAC = findViewById(R.id.editTextWriteTagDumpStaticAC); mEnableStaticAC = findViewById( R.id.checkBoxWriteTagDumpStaticAC); mWriteManufBlock = findViewById( R.id.checkBoxWriteTagDumpWriteManuf); mWriteModeLayouts = new ArrayList<>(); mWriteModeLayouts.add(findViewById( R.id.relativeLayoutWriteTagWriteBlock)); mWriteModeLayouts.add(findViewById(R.id.linearLayoutWriteTagDump)); mWriteModeLayouts.add(findViewById( R.id.linearLayoutWriteTagFactoryFormat)); mWriteModeLayouts.add(findViewById( R.id.relativeLayoutWriteTagValueBlock)); // Restore mDumpWithPos and the "write to manufacturer block"-state. if (savedInstanceState != null) { mWriteManufBlock.setChecked( savedInstanceState.getBoolean("write_manuf_block", false)); Serializable s = savedInstanceState .getSerializable("dump_with_pos"); if (s instanceof HashMap<?, ?>) { mDumpWithPos = (HashMap<Integer, HashMap<Integer, byte[]>>) s; } } Intent i = getIntent(); if (i.hasExtra(EXTRA_DUMP)) { // Write dump directly from editor. mDumpFromEditor = i.getStringArrayExtra(EXTRA_DUMP); mWriteDumpFromEditor = true; // Show "Write Dump" option and disable other write options. RadioButton writeBlock = findViewById( R.id.radioButtonWriteTagWriteBlock); RadioButton factoryFormat = findViewById( R.id.radioButtonWriteTagFactoryFormat); RadioButton writeDump = findViewById( R.id.radioButtonWriteTagWriteDump); writeDump.performClick(); writeBlock.setEnabled(false); factoryFormat.setEnabled(false); // Update button text. Button writeDumpButton = findViewById( R.id.buttonWriteTagDump); writeDumpButton.setText(R.string.action_write_dump); } }