2010-06-30 55 views
0

目前我正在尝试向我的应用程序 添加偏好活动,但发现我无法使其正常工作。 每一次,我都试着开始偏好活动,但在显示任何东西之前它只是崩溃。未能开始我的偏好活动

这里是清单

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="keysquare.android" 
     android:versionCode="1" 
     android:versionName="0.9"> 
    <application android:icon="@drawable/icon" android:label="@string/ime_name" android:debuggable="true"> 
     <service android:name="KeysquareAndroid" android:permission="android.permission.BIND_INPUT_METHOD"> 
      <intent-filter> 
       <action android:name="android.view.InputMethod" /> 
      </intent-filter> 
      <meta-data android:name="android.view.im" android:resource="@xml/method" /> 
     </service> 

     <activity android:label="KeysquareAndroidSettings" android:name="KeysquareAndroidSettings" android:exported="true" android:enabled="true"></activity> 

    </application> 
    <uses-sdk android:minSdkVersion="3" /> 


</manifest> 

而且偏好XML,我已经尽了最大努力修剪下来。

<?xml version="1.0" encoding="utf-8"?> 
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> 


</PreferenceScreen> 

最后偏好活动类,它看起来也正常,我...

package keysquare.android; 

import android.os.Bundle; 
import android.preference.PreferenceActivity; 

public class KeysquareAndroidSettings extends PreferenceActivity { 


    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     addPreferencesFromResource(R.xml.preferences); 

    } 
} 

在此先感谢如果有人可以提供帮助。

Jeanno

+0

你应该检查日志文件(logcat的),无论是在Eclipse或命令行 '亚行外壳logcat的'。如果它仍然不清楚,请在这里发布日志输出。 – 2010-06-30 05:42:46

回答

0

感谢Mathias。

最后问题解决了。 看来我不应该从服务中调用活动。 此外,在method.xml中,我应该引用一个完整的包,而不是使用本地引用的 。

Jeanno