Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onClick(View v) {
- InputMethodManager inputManager = (InputMethodManager) this.getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
- inputManager.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
- /* Voice recognition using Google Speech to Text API*/
- if (v.getId() == R.id.VoiceConvert) {
- entertext.setText("");
- Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
- intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
- intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, "com.sign.language");
- intent.putExtra(RecognizerIntent.EXTRA_PROMPT, getString(R.string.speak));
- intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.ENGLISH);
- intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1);
- startActivityForResult(intent, REQUEST_CODE);
- }
- }
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.uioneone);
- searchbtn = (ImageButton) findViewById(R.id.search_txt);
- vsearchbtn = (ImageButton) findViewById(R.id.VoiceConvert);
- signbtn = (ImageButton) findViewById(R.id.SignBible);
- exitbtn = (ImageButton) findViewById(R.id.TouchToExit);
- entertext = (EditText) findViewById(R.id.entert);
- imagev = (ImageView) findViewById(R.id.imageView1);
- imagev.setOnClickListener(this);
- searchbtn.setOnClickListener(this);
- vsearchbtn.setOnClickListener(this);
- signbtn.setOnClickListener(this);
- exitbtn.setOnClickListener(this);
- initSpeechRecognizer();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement