private String generateScreenOnOrOffUtternace(int feedbackIndex){
  int resourceId=(feedbackIndex == INDEX_SCREEN_ON) ? R.string.template_screen_on : R.string.template_screen_off;
  String template=mContext.getString(resourceId);
  int currentRingerVolume=mAudioManager.getStreamVolume(AudioManager.STREAM_RING);
  int maxRingerVolume=mAudioManager.getStreamMaxVolume(AudioManager.STREAM_RING);
  int volumePercent=(100 / maxRingerVolume) * currentRingerVolume;
  int adjustment=volumePercent % 10;
  if (adjustment < 5) {
    volumePercent-=adjustment;
  }
 else   if (adjustment > 5) {
    volumePercent+=(10 - adjustment);
  }
  return String.format(template,volumePercent);
}

private String generateScreenOnOrOffUtternace ( int feedbackIndex ) { int resourceId = ( feedbackIndex == INDEX_SCREEN_ON ) ? R . string . template_screen_on : R . string . template_screen_off ; String template = mContext . getString ( resourceId ) ; int currentRingerVolume = mAudioManager . getStreamVolume ( AudioManager . STREAM_RING ) ; int maxRingerVolume = mAudioManager . getStreamMaxVolume ( AudioManager . STREAM_RING ) ; int volumePercent = ( 100 / maxRingerVolume ) * currentRingerVolume ; int adjustment = volumePercent % 10 ; if ( adjustment < 5 ) { volumePercent -= adjustment ; } else if ( adjustment > 5 ) { volumePercent += ( 10 - adjustment ) ; } return String . format ( template , volumePercent ) ; }
generates an utterance for announcing screen on and screen off .
