Buggy code:
} else if ( selectedIntent == ( Constants . ENGLISH_NUMBER_VALUE ) ) { if ( ( selectedNumberLimit == ( Constants . SELECTED_NUM_VALUE_10 ) ) || ( selectedNumberLimit == 0 ) ) { String [ ] [ ] number10 = new String [ ] [ ] { new String [ ] { "<seq2seq4repair_space>1<seq2seq4repair_space>" , "<seq2seq4repair_space>2<seq2seq4repair_space>" } , new String [ ] { "<seq2seq4repair_space>3<seq2seq4repair_space>" , "<seq2seq4repair_space>4<seq2seq4repair_space>" } , new String [ ] { "5" , "6" } , new String [ ] { "7" , "8" } , new String [ ] { "9" , "10" } } ; alphabet = number10 ; } else if ( selectedNumberLimit == ( Constants . SELECTED_NUM_VALUE_20 ) ) { String [ ] [ ] number20 = new String [ ] [ ] { new String [ ] { "<seq2seq4repair_space>1<seq2seq4repair_space>" , "<seq2seq4repair_space>2<seq2seq4repair_space>" , "<seq2seq4repair_space>3<seq2seq4repair_space>" , "<seq2seq4repair_space>4<seq2seq4repair_space>" } , new String [ ] { "<seq2seq4repair_space>5<seq2seq4repair_space>" , "<seq2seq4repair_space>6<seq2seq4repair_space>" , "<seq2seq4repair_space>7<seq2seq4repair_space>" , "<seq2seq4repair_space>8<seq2seq4repair_space>" } , new String [ ] { "9" , "10" , "11" , "12" } , new String [ ] { "13" , "14" , "15" , "16" } , new String [ ] { "17" , "18" , "19" , "20" } } ; alphabet = number20 ; } else if ( selectedNumberLimit == ( Constants . SELECTED_NUM_VALUE_100 ) ) { int count = 1 ; String [ ] [ ] number100 = new String [ 20 ] [ 5 ] ; for ( int i = 0 ; i < ( number100 . length ) ; i ++ ) { for ( int j = 0 ; j < ( number100 [ i ] . length ) ; j ++ ) { if ( i != 0 ) { number100 [ i ] [ j ] = "" + ( count ++ ) ; } else { number100 [ i ] [ j ] = ( "<seq2seq4repair_space>" + ( count ++ ) ) + "<seq2seq4repair_space>" ; } } } alphabet = number100 ; isAllNumberSelected = true ; } } TableLayout tableLayout = ( ( TableLayout ) ( findViewById ( alphabet ) ) ) ; final TextView alphabetText = ( ( TextView ) ( findViewById ( imageView_text ) ) ) ; alphabetText . setVisibility ( INVISIBLE ) ; ImageView imageView = ( ( ImageView ) ( findViewById ( imageView_grid ) ) ) ; imageView . setVisibility ( INVISIBLE ) ; final VideoView videoview = ( ( VideoView ) ( findViewById ( videoView_grid ) ) ) ; videoview . setVisibility ( INVISIBLE ) ; for ( int i = 0 ; i < ( alphabet . length ) ; i ++ ) { TableRow row = new TableRow ( this ) ; row . setBackgroundColor ( GRAY ) ; row . setMinimumHeight ( 70 ) ; for ( int j = 0 ; j < ( alphabet [ i ] . length ) ; j ++ ) { final TextView textView = new TextView ( this ) ; textView . setText ( alphabet [ i ] [ j ] ) ; textView . setTextSize ( 60 ) ; if ( ( ( i + j ) % 2 ) == 0 ) { textView . setBackgroundColor ( WHITE ) ; } textView . setGravity ( CENTER ) ; textView . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( ( ! ( videoview . isPlaying ( ) ) ) && ( ( videoview . getVisibility ( ) ) == ( View . VISIBLE ) ) ) { videoview . setVisibility ( INVISIBLE ) ; return ; } String audioPath = "" ; ImageView imageView = ( ( ImageView ) ( findViewById ( imageView_grid ) ) ) ; try { String imgPath = "" ; <START_BUG> if ( ( ! ( isAllNumberSelected ) ) || ( ( isAllNumberSelected ) && ( ( Integer . parseInt ( textView . getText ( ) . toString ( ) ) ) <= 20 ) ) ) { <END_BUG> imgPath = ( "english_" + ( textView . getText ( ) . toString ( ) . toLowerCase ( ) . trim ( ) ) ) + ".jpg" ; } else { imgPath = "english_100.jpg" ; } InputStream si1 = getAssets ( ) . open ( imgPath ) ; Bitmap image = BitmapFactory . decodeStream ( si1 ) ; Bitmap scaledImage = Bitmap . createScaledBitmap ( image , imageView . getWidth ( ) , ( ( int ) ( ( imageView . getHeight ( ) ) * 0.7 ) ) , true ) ; imageView . setImageBitmap ( scaledImage ) ; alphabetText . setText ( textView . getText ( ) ) ; alphabetText . setTextSize ( 100 ) ; alphabetText . setBackgroundColor ( WHITE ) ; alphabetText . setTextColor ( RED ) ; alphabetText . setGravity ( CENTER ) ; alphabetText . setVisibility ( VISIBLE ) ; imageView . setVisibility ( VISIBLE ) ; mAnimationTopLeft = AnimationUtils . loadAnimation ( getApplicationContext ( ) , animation_top_left ) ; mAnimationBottomRight = AnimationUtils . loadAnimation ( getApplicationContext ( ) , animation_bottom_right ) ; mAnimationTopRight = AnimationUtils . loadAnimation ( getApplicationContext ( ) , animation_top_right ) ; mAnimationBottomLeft = AnimationUtils . loadAnimation ( getApplicationContext ( ) , animation_bottom_left ) ; Random r = new Random ( ) ; int random = ( r . nextInt ( ( 80 - 65 ) ) ) + 65 ; if ( ( random % 4 ) == 0 ) { imageView . startAnimation ( mAnimationTopLeft ) ; } else if ( ( random % 4 ) == 1 ) { imageView . startAnimation ( mAnimationTopRight ) ; } else if ( ( random % 4 ) == 2 ) { imageView . startAnimation ( mAnimationBottomLeft ) ; } else if ( ( random % 4 ) == 3 ) { imageView . startAnimation ( mAnimationBottomRight ) ; } String text2Speech = Utility . getTextByAlphabet ( textView . getText ( ) . toString ( ) ) ;

Fix:
if ( ( ! ( isAllNumberSelected ) ) || ( ( isAllNumberSelected ) && ( ( Integer . parseInt ( textView . getText ( ) . toString ( ) . trim ( ) ) ) <= 20 ) ) ) {