You have nested your second activity inside your 1st activity inthe
manifest. Change the lines

from:
          <activity android:name=".SecondScreenView"></activity>

        </activity>

to:
        </activity>

        <activity android:name=".SecondScreenView"></activity>

and I should now work


On Aug 1, 2:28 pm, Dean Rochester <rockie1...@gmail.com> wrote:
> I am trying to create a two activity test application using eclipse.
>
> I have been pulling my hair out on this one.
>
> In my main activity class in a package called  com.deano  I have the
> following snippet of code
>
>         Button next = (Button) findViewById(R.id.Button01);
>         next.setOnClickListener(new View.OnClickListener() {
>             public void onClick(View view) {
>                 Intent myIntent = new Intent(view.getContext(),
> SecondScreenView.class);
>                 startActivityForResult(myIntent, 0);
>             }
>
>         });
>
> also in com.deano is the SecondScreenView activity class
>
> when I click the button, it fails to create the new activity saying....
>
> 08-01 03:49:30.330: ERROR/AndroidRuntime(4502): Caused by:
> android.content.ActivityNotFoundException: Unable to find explicit
> activity class {com.deano/com.deano.SecondScreenView}; have you
> declared this activity in your AndroidManifest.xml?
>
> Here is my AndroidManifest.xml too showing the SecondScreenView
> activity defined.
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
>       package="com.deano"
>       android:versionCode="1"
>       android:versionName="1.0">
>     <application android:icon="@drawable/icon" 
> android:label="@string/app_name">
>         <activity android:name=".MainScreenView"
>                   android:label="@string/app_name">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>                 <category android:name="android.intent.category.LAUNCHER" />
>             </intent-filter>
>
>             <activity android:name=".SecondScreenView"></activity>
>
>         </activity>
>
>     </application>
>
> </manifest>
>
> Why am I getting this error when I click on the button?

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to