Jordan Hochstetler
Jordan Hochstetler

Reputation: 1416

Android Activity.Not.Found Intent

I have one Activity running and when I click a button I want the next Activity to pop up. It should be simple, but I don't know what's going on here. I don't understand why I am getting this error. I have looked at other people's errors and tried to fix it, but nothings working. When I match the action name and when I call it in java I still get this error. I'm not sure what I'm doing wrong.

This is what I got for my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jordan.dictation"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Recorder" 
        android:theme="@style/AppBaseTheme"
        android:label="@string/app_name" >
        <action android:name="com.jordan.dictation.RECORDER" />
        <category android:name="android.intent.category.DEFAULT" />
    </activity>
</application>

This is my Javacode for first activity that is suppose to call the other Activity "Recorder.java" when the button is clicked:

    public class MainActivity extends Activity {

Button bn_Add;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    bn_Add = (Button) findViewById(R.id.button_nav_add_recording);
    bn_Add.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO start other activity
            try
            {
                // this is the code that I am surrounding in the try/catch block
                Intent openRecorder = new Intent("com.jordan.dictation.RECORDER");
                startActivity(openRecorder);
            }
            catch (Exception e)
            {
                // this is the line of code that sends a real error message to the log
                Log.e("ERROR", "ERROR IN CODE: " + e.toString());

                // this is the line that prints out the location in
                // the code where the error occurred.
                e.printStackTrace();
            }


        }
    });

Upvotes: 0

Views: 1555

Answers (2)

madlymad
madlymad

Reputation: 6530

Try that:

Intent intent = new Intent(MainActivity.this, Recorder.class);
startActivity(intent);

instead of

Intent openRecorder = new Intent("com.jordan.dictation.RECORDER");
startActivity(openRecorder);

clean and built your code to make sure!

Upvotes: 0

Kapil Vats
Kapil Vats

Reputation: 5515

try this

<activity android:name=".Recorder" 
    android:theme="@style/AppBaseTheme"
    android:label="@string/app_name" >
  <intent-filter>
    <action android:name="com.jordan.dication.RECORDER" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>

you are not using intent filter in your mainfest file

Upvotes: 1

Related Questions