Hi,
Scenario:
I want the voice recognition to be part in background process. I can execute background processing (NO problem). And I want to call a voice recognition. The code below runs perfect. But I don't know how to include it on background process. (Note: I've used service in to create a background process).
Problem:
How can I run this code below in background processing ?
Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
i.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak ...");
startActivityForResult(i,check);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if (requestCode == 1234 && resultCode == RESULT_OK ) {
ArrayList<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,results));
}
super.onActivityResult(requestCode, resultCode, data);
}
Please help...
Thanks,
Cris
Scenario:
I want the voice recognition to be part in background process. I can execute background processing (NO problem). And I want to call a voice recognition. The code below runs perfect. But I don't know how to include it on background process. (Note: I've used service in to create a background process).
Problem:
How can I run this code below in background processing ?
Intent i = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
i.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
i.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak ...");
startActivityForResult(i,check);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if (requestCode == 1234 && resultCode == RESULT_OK ) {
ArrayList<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,results));
}
super.onActivityResult(requestCode, resultCode, data);
}
Please help...
Thanks,
Cris