@@ -205,7 +205,7 @@ public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
205
205
mPresenter .onGetUnitsToDisplay (mConversionId );
206
206
207
207
// Takes care of restoring the ViewState after a screen rotation
208
- if (mState != null ) {
208
+ if (mState != null ) {
209
209
if (mState .getFromId () < 0 || mState .getToId () < 0 ) {
210
210
// Empty initial state, set state from default checked buttons
211
211
mState .setFromId (mGrpFrom .getCheckedRadioButtonId ());
@@ -464,20 +464,22 @@ public Context getContext() {
464
464
// Radio Group checked change listener
465
465
@ Override
466
466
public void onCheckedChanged (RadioGroup group , int checkedId ) {
467
- Unit unit = getCheckedUnit (group );
468
- switch (group .getId ()) {
469
- case R .id .radio_group_from :
470
- mState .setFromId (checkedId );
471
- mTxtUnitFrom .setText (unit .getLabelResource ());
472
- break ;
467
+ if (mState != null ) {
468
+ Unit unit = getCheckedUnit (group );
469
+ switch (group .getId ()) {
470
+ case R .id .radio_group_from :
471
+ mState .setFromId (checkedId );
472
+ mTxtUnitFrom .setText (unit .getLabelResource ());
473
+ break ;
474
+
475
+ case R .id .radio_group_to :
476
+ mState .setToId (checkedId );
477
+ mTxtUnitTo .setText (unit .getLabelResource ());
478
+ break ;
479
+ }
473
480
474
- case R .id .radio_group_to :
475
- mState .setToId (checkedId );
476
- mTxtUnitTo .setText (unit .getLabelResource ());
477
- break ;
481
+ convert ();
478
482
}
479
-
480
- convert ();
481
483
}
482
484
483
485
// Change in shared preferences
0 commit comments