انجمن سایت کلیدستان


رتبه موضوع:
  • 1 رای - 5 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
استفاده از tts=text to speech در برنامه اندروید

استفاده از tts=text to speech در برنامه اندروید

#1
با درود.برای برنامه ام از tts=text to speech استفاده کردم وبدون هیچ مشکلی کار میکند.ولی علامت های ** که در متن استفاده کردم را نیز تلفظ میکند.چطور علامت های ** از تلفظ شدن محروم کنم؟تمامی کد ها به نقل از لینک زیر:http://www.tutorialspoint.com/android/an...speech.htmلطفا با استفاده از کدهای همین وبسایت تغییرات لازم را توضیح دهید. باتشکر فراوان.

کد پی‌اچ‌پی:
public class MainActivity extends Activity {
   
TextToSpeech t1;
   
EditText ed1;
   
Button b1;
   
   @
Override
   
protected void onCreate(Bundle savedInstanceState) {
      
super.onCreate(savedInstanceState);
      
setContentView(R.layout.activity_main);
      
ed1=(EditText)findViewById(R.id.editText);
      
b1=(Button)findViewById(R.id.button);
      
      
t1=new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
         @
Override
         
public void onInit(int status) {
            if(
status != TextToSpeech.ERROR) {
               
t1.setLanguage(Locale.UK);
            }
         }
      });
      
      
b1.setOnClickListener(new View.OnClickListener() {
         @
Override
         
public void onClick(View v) {
            
String toSpeak ed1.getText().toString();
            
Toast.makeText(getApplicationContext(), toSpeak,Toast.LENGTH_SHORT).show();
            
t1.speak(toSpeakTextToSpeech.QUEUE_FLUSHnull);
         }
      });
   }
   
   public 
void onPause(){
      if(
t1 !=null){
         
t1.stop();
         
t1.shutdown();
      }
      
super.onPause();
   } 
پاسخ
 سپاس شده توسط شماره مجازی امارات ، تلگرام ضد فیلتر 2023


پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان