Skip to content
Snippets Groups Projects
Select Git revision
  • 5e4bc5c71ea0f0dd6d67cc259689af763f24c3c4
  • master default
2 results

ExampleUnitTest.java

Blame
  • Generate.java 4.64 KiB
    package com.example.venkat.and;
    
    import android.content.ActivityNotFoundException;
    import android.content.Context;
    import android.content.Intent;
    import android.speech.RecognizerIntent;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.TextView;
    import android.widget.Toast;
    
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.OutputStreamWriter;
    import java.util.ArrayList;
    import java.util.Locale;
    
    public class Generate extends AppCompatActivity {
        protected TextView resultTEXT;
        protected String para;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_generate);
            resultTEXT=(TextView) findViewById(R.id.qs);
            promptSpeechInput();
        }
    
    
    
    
    
    
        public void record_button(View v)
        {
            if(v.getId()==R.id.record_id)
            {
                promptSpeechInput();
            }
        }
    
    
        public void promptSpeechInput()
        {
    
            Intent i= new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
            i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
            i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, Locale.getDefault());
            i.putExtra(RecognizerIntent.EXTRA_PROMPT,"Question please");
            try {
                startActivityForResult(i, 100);
            }
            catch (ActivityNotFoundException a)
            {
                String qa=a.toString();
                Toast.makeText(this, qa, Toast.LENGTH_SHORT).show();
            }
    
            Toast.makeText(this, "VOICE RECORDED1", Toast.LENGTH_SHORT).show();
        }
    
        public void onActivityResult (int request_code,int result_code,Intent i)
        {
            super.onActivityResult(request_code,result_code,i);