android.content.ActivitNotFoundException

All your problems with Audio, Video and Images.

android.content.ActivitNotFoundException

Postby mukeshkumar » Wed Feb 24, 2010 8:14 am

Hi all

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 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>
mukeshkumar
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Feb 24, 2010 8:06 am

Top

Re: android.content.ActivitNotFoundException

Postby Rahul » Wed Feb 24, 2010 10:16 am

you will get this error if there are no applications installed in your emulator or on device to handle this intent.

check this link

http://developer.android.com/reference/ ... IZE_SPEECH


Edit

Probably a device will have this intent and i hope u are trying it on a emulator
Rahul
Experienced Developer
Experienced Developer
 
Posts: 89
Joined: Wed Oct 01, 2008 11:16 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 10 guests