ActivityNotFound异常抛出在AndroidManifest.xml中列出的preferenceActivity [英] ActivityNotFound exception thrown for PreferenceActivity listed in AndroidManifest.xml

查看:120
本文介绍了ActivityNotFound异常抛出在AndroidManifest.xml中列出的preferenceActivity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个preference屏幕添加到我的应用程序。

I'm trying to add a Preference screen to my app.

preferences.java:

 public class Preferences extends PreferenceActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.layout.preferences);
    }
 }

preferences.xml

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
  xmlns:android="http://schemas.android.com/apk/res/android">
  <PreferenceCategory
    android:title="General Settings">
    <RingtonePreference
        android:name="Ringtone"
        android:summary="Select a Ringtone for recieved messages"
        android:title="Rington"
        android:key="ringtonPref" />
  </PreferenceCategory>
  <PreferenceCategory
    android:title="Account Settings">
        <Preference
            android:title="Sign Out"
            android:summary="Sign out of current account"
            androidKey="signOut" />
    </PreferenceCategory>
</PreferenceScreen>

的Andr​​oidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="steamanywhere.com"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon"
                 android:label="@string/app_name"
                 android:theme="@android:style/Theme.NoTitleBar"
                 android:debuggable="true">
        <activity android:name=".SteamAnywhere"
                  android:label="@string/app_name">

        </activity>

        <acitivity android:name="steamanywhere.com.Preferences" >
        </acitivity>    
        <activity android:name=".StartupScreen" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service android:enabled="true" android:name=".WebEventListener" />
    </application>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>

</manifest> 

在preferences活动开始SteamAnywhere.java具有以下code:

The Preferences activity is started in SteamAnywhere.java with the following code:

Intent preferenceIntent = new Intent(this, steamanywhere.com.Preferences.class);
startActivity(preferenceIntent);

startActivity(preferenceIntent); 我得到了以下异常:

android.content.ActivityNotFoundException: Unable to find explicit activity class {steamanywhere.com/steamanywhere.com.Preferences}; have you declared this activity in your AndroidManifest.xml?

但声明..任何想法?

But it is declared.. Any ideas?

我已经经历了许多类似的问题,但看着没有回答的为我工作。

I've looked through many similar questions but none of the answers work for me.

推荐答案

我想答案可能是在XML

I think the answer may be in your xml

<acitivity android:name="steamanywhere.com.Preferences" >
</acitivity> 

您已经拼活动错了。

<activity android:name="steamanywhere.com.Preferences" >
</activity> 

另外,你为什么不刚才说什么?

Also, why do you not just say?

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

这篇关于ActivityNotFound异常抛出在AndroidManifest.xml中列出的preferenceActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆