0

我有一个想要从偏好屏幕加载的活动。我收到以下错误:

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?

我的偏好屏幕代码:

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

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

我要加载的活动

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

}

这也是我的清单:

<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>

我不擅长这个 Android XML 的东西,我习惯于触发 2d 图形编程。为什么他们把事情弄得这么乱?

4

3 回答 3

3

在您的 AndroidManifest 文件中添加您的活动。

像这样:

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

希望这可以帮助

于 2012-06-23T16:29:34.497 回答
1

您已将活动声明为com.polygonattraction.app.functions.Settings它的实际名称似乎是com.polygonattraction.app.functions.GetImageActivity.

尝试在清单中使用以下内容:

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

代替

<activity
    android:label="settings"
    android:name="com.polygonattraction.app.functions.Settings"
    android:exported="true">
</activity>
于 2012-06-23T16:32:31.257 回答
1

使 GetImageActivity 的条目也在清单中,就像设置一样

于 2012-06-23T16:34:34.390 回答