Problem :- When i click mic button and speak on my (Speech to text App) anything then its work and write the text successfully on the Edittext Box and Again i click the mic button and speak some voice then its write successfully but the previous text on the Editext Box is Erase on.

What Lines of code required i don't know Guys please Help me guys.

private static final int REQUEST_CODE_SPEECH_INPUT = 1000;
EditText mTextTv;
ImageButton mVoiceBtn;
Spinner spinner;
int currentItem = 0;

private void promptSpeechInput() {
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getISOLanguages());
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Hi Speak Anything");
    try {
        startActivityForResult(intent, REQUEST_CODE_SPEECH_INPUT);

    catch (Exception e){

        Toast.makeText(this, ""+e.getMessage(), Toast.LENGTH_SHORT).show();


protected void onActivityResult (int requestCode, int resultCode, @Nullable Intent data){
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == REQUEST_CODE_SPEECH_INPUT) {
        if (resultCode == RESULT_OK && null != data) {

            ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);


0 Answers