Oliver Dixon
Oliver Dixon

Reputation: 7424

PreferenceScreen launch activity

I have an activity that I'd like to load from a preference screen. I'm getting the following error:

06-23 16:12:00.470: E/AndroidRuntime(3410): android.content.ActivityNotFoundException:    Unable to find explicit activity class {com.polygonattraction.app/com.polygonattraction.app.functions.GetImageActivity}; have you declared this activity in your AndroidManifest.xml?

My Preference screen code:

         <PreferenceScreen 
        android:title="Get faces"
        android:summary="Get the faces.">

        <intent 
            android:targetClass="com.polygonattraction.app.functions.GetImageActivity"
            android:targetPackage="com.polygonattraction.app" 
         />
    </PreferenceScreen>

Activity I'd like to load

public class GetImageActivity extends Activity 
{
public void onCreate()
{
    System.out.println("Started activity...");
            setContentView(R.layout.actilayout); //not done yet
}

}

Here's my manifest also:

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

<application 
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    >

    <service
        android:label="@string/app_name"
        android:name=".LiveService"        
        android:permission="android.permission.BIND_WALLPAPER"
        >

        <intent-filter android:priority="1">
            <action android:name="android.service.wallpaper.WallpaperService" />
        </intent-filter>

        <meta-data android:name="android.service.wallpaper" android:resource="@xml/wallpaper" />
    </service>

    <activity
        android:label="settings"
        android:name="com.polygonattraction.app.functions.Settings"
        android:exported="true">
    </activity>

</application>

I'm not good at this Android XML stuff, I'm used to trigga 2d graphics programming. Why have they made it so messy?

Upvotes: 0

Views: 1124

Answers (3)

Dheeresh Singh
Dheeresh Singh

Reputation: 15701

make the entry for GetImageActivity also in manifest as like for settings is there

Upvotes: 1

Raghav Sood
Raghav Sood

Reputation: 82563

You have declared the activity as com.polygonattraction.app.functions.Settings while it's actual name seems to be com.polygonattraction.app.functions.GetImageActivity.

Try using the following in your manifest:

<activity
    android:label="settings"
    android:name="com.polygonattraction.app.functions.GetImageActivity"
    android:exported="true">
</activity>

Instead of

<activity
    android:label="settings"
    android:name="com.polygonattraction.app.functions.Settings"
    android:exported="true">
</activity>

Upvotes: 1

Sarim Sidd
Sarim Sidd

Reputation: 2176

Add your activiy in your AndroidManifest file.

Like this:

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

Hope This Helps

Upvotes: 3

Related Questions