Hi sandeep
Problem: When we run this program. then after click the button(voice
Recognition)
Show message box with exception what we catch
Exception:
android.content.ActivitNotFoundException:No Activity Found to handle
Intent{action=android.speech.action.RECOGNIZE_SPEECH}
Please give me solution of it. why
ActivityNotFoundException( android.speech.action.RECOGNIZE_SPEECH )throws
in program
SpeechActivity.java
package com.tutorial;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class SpeechActivtiy extends Activity
{
Button Voice_Rec_BTN;
EditText VoiceResults_Txt;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.speech);
Voice_Rec_BTN = (Button) findViewById(R.id.startvoice);
Voice_Rec_BTN.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
startVoiceRecognitionActivity();
}
});
}
/**
* Fire an intent to start the speech recognition activity.
*/
private void startVoiceRecognitionActivity()
{
Intent intent = new
Intent("android.speech.action.RECOGNIZE_SPEECH");
//intent.setAction(ACTIVITY_SERVICE);
try
{
startActivityForResult(intent, 0);
} catch (Exception e)
{
// TODO Auto-generated catch block
Log.e(":::ERROR::", e.toString());
Toast.makeText(SpeechActivtiy.this, e.toString(),
10).show();
}
Log.v(":::","444");
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
}
}
speech.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/rellayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="341px"
android:layout_below="@+id/startvoice"
android:layout_alignParentLeft="true"
>
</ListView>
<Button
android:id="@+id/startvoice"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Voice Recognition"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
>
</Button>
</RelativeLayout>
AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tutorial"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/
app_name">
<activity android:name=".SpeechActivtiy"
android:label="@string/hello">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" /
>
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
</manifest>
string.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, SpeechToText!</string>
<string name="app_name">SpeechTutorial</string>
<string name="voice_recognition_prompt"> voice recognition Demo</
string>
<string name="speak_button">Speak!</string>
</resources>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en