Unable to Show imageView in recyclerVIew synchronously with TTS

前端 未结 3 1441
面向向阳花
面向向阳花 2020-12-11 09:44

How can i show/Hide imageView in recyclerView as TTS(text to speech) plays for all the available list items, one by one!

Activity method -This met

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 10:26

    Put the below code snippet inside your Adapter in OnBindViewHolder

            text = item.first + "  " + item.getSecond() + " Za " + item.getResult() + ".";
            tts.speak(text, TextToSpeech.QUEUE_ADD, null);
            boolean speakingEnd = tts.isSpeaking();
    
    
            if(speakingEnd){
                Toast.makeText(getApplicationContext(), "Speaking...."+position, Toast.LENGTH_SHORT).show();
                multiples1.setImage_show(true);
                mAdapter.notifyItemChanged(position);
    
            } else {
                Toast.makeText(getApplicationContext(), "Done...."+position, Toast.LENGTH_SHORT).show();
            }
    

    May this help Thanks.

提交回复
热议问题