Buggy code:
public class NewChallengeActivity extends CogniActivity { private Intent mIntent ; private ArrayList < CogniCheckBox > mSubjectCheckboxes ; private ArrayList < CheckBox > mCategoryCheckboxes ; private ScrollView mSvCategories ; private CogniRadioButton mRbDefaultTest ; private CogniRadioButton mRbDefaultOpponent ; private ViewFlipper mViewFlipper ; private String mSelectedTest ; private HashSet < String > mSelectedSubjects ; private HashSet < String > mSelectedCategories ; private String mSelectedOpponent ; private HashMap < CheckBox , String > mCategoryCheckboxToCategory ; private final String DEFAULT_TEST = Test . BOTH ; private final String DEFAULT_OPPONENT = OpponentType . FRIEND ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } private void displayTests ( ) { } private void displaySubjects ( ) { } private void drawCategories ( ) { } private void displayOpponent ( ) { int user1or2 = mIntent . getIntExtra ( USER1OR2 , ( - 1 ) ) ; if ( user1or2 == 1 ) { LinearLayout llOpponentsHolder = ( ( LinearLayout ) ( findViewById ( llOpponentsHolder ) ) ) ; LinearLayout llOpponentRow = null ; CogniRadioGroup mRgOpponents = new CogniRadioGroup ( ) ; int numColumns = 2 ; String [ ] opponentTypes = OpponentType . getOpponentTypes ( ) ; for ( int i = 0 ; i < ( opponentTypes . length ) ; i ++ ) { if ( ( i % numColumns ) == 0 ) { llOpponentRow = new LinearLayout ( this ) ; llOpponentRow . setOrientation ( HORIZONTAL ) ; llOpponentRow . setLayoutParams ( new LinearLayout . LayoutParams ( LayoutParams . MATCH_PARENT , LayoutParams . WRAP_CONTENT ) ) ; llOpponentsHolder . addView ( llOpponentRow ) ; } String opponentType = opponentTypes [ i ] ; CogniRadioButton radioButton = new CogniRadioButton ( this ) ; radioButton . setLayoutParams ( new LinearLayout . LayoutParams ( 0 , LayoutParams . WRAP_CONTENT , 1.0F ) ) ; mRgOpponents . add ( radioButton ) ; radioButton . setOnClickListener ( new CogniRadioButton . OnClickListener ( ) { @ Override public void onClick ( View v ) { mSelectedOpponent = ( ( CogniRadioButton ) ( v ) ) . getText ( ) . toString ( ) ; } } ) ; radioButton . setText ( opponentType ) ; llOpponentRow . addView ( radioButton ) ; if ( opponentType . equals ( DEFAULT_OPPONENT ) ) { mRbDefaultOpponent = radioButton ; } } } else { <START_BUG> CardView cvOpponent = ( ( CardView ) ( findViewById ( llOpponent ) ) ) ; <END_BUG> cvOpponent . setVisibility ( INVISIBLE ) ; } } private void setDefaults ( ) { } public void changeSelectedTest ( CogniRadioButton rbTest ) { } public void addOrRemoveSelectedSubject ( CogniCheckBox cbSubject ) { } public void onClick_btnChooseCategories ( View view ) { } private void displayCategories ( ) { } public void addOrRemoveSelectedCategory ( CheckBox cbCategory ) { } public void onClick_btnPlayNow ( View view ) { } private void saveChallenge ( ) { } private void saveNewChallenge ( ) { } private void savePracticeChallenge ( final Challenge challenge , PublicUserData publicUserData ) { } private void saveExistingChallenge ( ) { } private void showOrHideNextButton ( ) { } private void navigateToPracticeChallengeActivity ( String challengeId , int user1or2 ) { } private void navigateToChooseBoardConfigurationActivity ( String challengeId , int user1or2 ) { } private void navigateToChooseOpponentActivity ( String challengeId , int user1or2 ) { } private String getChallengeType ( ) { } }

Fix:
CardView cvOpponent = ( ( CardView ) ( findViewById ( cvOpponent ) ) ) ;