private void updateLanguagePreference(String language) { TextView textView = (TextView) findViewById(R.id.language_preference); textView.setText(language); }
private void updateLanguagePreference(String language) { TextView textView = (TextView) findViewById(R.id.language_preference); textView.setText(language); }
/** * Called with the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new Handler(); // Inflate our UI from its XML layout description. setContentView(R.layout.voice_recognition); // Get display items for later interaction Button speakButton = (Button) findViewById(R.id.btn_speak); mList = (ListView) findViewById(R.id.list); mSupportedLanguageView = (Spinner) findViewById(R.id.supported_languages); // Check to see if a recognition activity is present PackageManager pm = getPackageManager(); List<ResolveInfo> activities = pm.queryIntentActivities( new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); if (activities.size() != 0) { speakButton.setOnClickListener(this); } else { speakButton.setEnabled(false); speakButton.setText("Recognizer not present"); } // Most of the applications do not have to handle the voice settings. If the application // does not require a recognition in a specific language (i.e., different from the system // locale), the application does not need to read the voice settings. refreshVoiceSettings(); }
/** * Called with the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = new Handler(); // Inflate our UI from its XML layout description. setContentView(R.layout.voice_recognition); // Get display items for later interaction Button speakButton = (Button) findViewById(R.id.btn_speak); mList = (ListView) findViewById(R.id.list); mSupportedLanguageView = (Spinner) findViewById(R.id.supported_languages); // Check to see if a recognition activity is present PackageManager pm = getPackageManager(); List<ResolveInfo> activities = pm.queryIntentActivities( new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); if (activities.size() != 0) { speakButton.setOnClickListener(this); } else { speakButton.setEnabled(false); speakButton.setText("Recognizer not present"); } // Most of the applications do not have to handle the voice settings. If the application // does not require a recognition in a specific language (i.e., different from the system // locale), the application does not need to read the voice settings. refreshVoiceSettings(); }