Buggy code:
public class NewVenue extends ActionBarActivity { SessionData sessionData = SessionData . getInstance ( ) ; ImageView picChooser ; Button createVenue ; public static final int REQUEST_CODE = 1 ; Bitmap bitmap = null ; EditText nameField ; EditText cityField ; EditText addressField ; EditText phoneField ; EditText latitudeField ; EditText longitudeField ; EditText hoursField ; EditText capacityField ; EditText workTimeField ; String name ; String city ; String type ; String address ; String hours ; String phone ; String latitude ; String longitude ; String capacity ; String workTime ; String encodedImage ; Spinner cities ; Spinner types ; int owner_id ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_new_venue ) ; nameField = ( ( EditText ) ( findViewById ( R . id . name ) ) ) ; addressField = ( ( EditText ) ( findViewById ( R . id . address ) ) ) ; phoneField = ( ( EditText ) ( findViewById ( R . id . phone ) ) ) ; hoursField = ( ( EditText ) ( findViewById ( R . id . hours ) ) ) ; capacityField = ( ( EditText ) ( findViewById ( R . id . capacity ) ) ) ; workTimeField = ( ( EditText ) ( findViewById ( R . id . hours ) ) ) ; owner_id = sessionData . getUser ( ) . getId ( ) ; cities = ( ( Spinner ) ( findViewById ( R . id . city ) ) ) ; types = ( ( Spinner ) ( findViewById ( R . id . type ) ) ) ; ArrayAdapter < CharSequence > venueTypeAdapter ; venueTypeAdapter = ArrayAdapter . createFromResource ( this , venues_type_array , simple_spinner_item ) ; venueTypeAdapter . setDropDownViewResource ( simple_spinner_dropdown_item ) ; types . setAdapter ( venueTypeAdapter ) ; ArrayAdapter < CharSequence > venueCityAdapter ; venueCityAdapter = ArrayAdapter . createFromResource ( this , cities_array , simple_spinner_item ) ; venueCityAdapter . setDropDownViewResource ( simple_spinner_dropdown_item ) ; cities . setAdapter ( venueCityAdapter ) ; picChooser = ( ( ImageView ) ( findViewById ( venuePictureChooser ) ) ) ; createVenue = ( ( Button ) ( findViewById ( buttonCreatedVenue ) ) ) ; picChooser . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { Intent galleryIntent = new Intent ( Intent . ACTION_GET_CONTENT , null ) ; galleryIntent . setType ( "image//*" ) ; galleryIntent . addCategory ( CATEGORY_OPENABLE ) ; Intent cameraIntent = new Intent ( MediaStore . ACTION_IMAGE_CAPTURE ) ; Intent chooser = new Intent ( Intent . ACTION_CHOOSER ) ; chooser . putExtra ( EXTRA_INTENT , galleryIntent ) ; chooser . putExtra ( EXTRA_TITLE , "Choose<seq2seq4repair_space>Action" ) ; Intent [ ] intentArray = new Intent [ ] { cameraIntent } ; chooser . putExtra ( EXTRA_INITIAL_INTENTS , intentArray ) ; startActivityForResult ( chooser , NewVenue . REQUEST_CODE ) ; } } ) ; createVenue . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { name = nameField . getText ( ) . toString ( ) ; city = cities . getSelectedItem ( ) . toString ( ) ; type = types . getSelectedItem ( ) . toString ( ) ; hours = hoursField . getText ( ) . toString ( ) ; phone = phoneField . getText ( ) . toString ( ) ; address = addressField . getText ( ) . toString ( ) ; capacity = capacityField . getText ( ) . toString ( ) ; workTime = workTimeField . getText ( ) . toString ( ) ; if ( ( ( ( ( ( name . equals ( "" ) ) || ( hours . equals ( "" ) ) ) || ( phone . equals ( "" ) ) ) || ( address . equals ( "" ) ) ) || ( capacity . equals ( "" ) ) ) || ( workTime . equals ( "" ) ) ) { Toast . makeText ( getApplicationContext ( ) , "Please<seq2seq4repair_space>Fill<seq2seq4repair_space>Out<seq2seq4repair_space>All<seq2seq4repair_space>The<seq2seq4repair_space>Information" , LENGTH_SHORT ) . show ( ) ; } else { if ( ( bitmap ) == null ) { Toast . makeText ( getApplicationContext ( ) , "Please<seq2seq4repair_space>choose<seq2seq4repair_space>a<seq2seq4repair_space>picture" , LENGTH_SHORT ) . show ( ) ; } else { ByteArrayOutputStream streamS = new ByteArrayOutputStream ( ) ; <START_BUG> bitmap . compress ( PNG , 100 , streamS ) ; <END_BUG> byte [ ] byteArray = streamS . toByteArray ( ) ; encodedImage = Base64 . encodeToString ( byteArray , URL_SAFE ) ; PostRequestVenue postRequestVenue = null ; try { postRequestVenue = new PostRequestVenue ( NewVenue . this , name , type , phone , city , address , "0" , "0" , workTime , capacity , Integer . toString ( owner_id ) , encodedImage ) ; int a = 2 ; } catch ( NetworkErrorException e ) { e . printStackTrace ( ) ; } String result = "" ; if ( postRequestVenue != null ) { try { result = postRequestVenue . execute ( ) . get ( ) ; updateVenueDB ( ) ; Toast . makeText ( getApplicationContext ( ) , "Venue<seq2seq4repair_space>Created<seq2seq4repair_space>Successfully" , LENGTH_SHORT ) . show ( ) ; finish ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } catch ( ExecutionException e ) { e . printStackTrace ( ) ; } } } } } } ) ; } private void updateVenueDB ( ) { } @ Override public void onActivityResult ( int requestCode , int resultCode , Intent data ) { } }

Fix:
bitmap . compress ( JPEG , 100 , streamS ) ;