views:

28

answers:

1

Hi,

Currently I am trying to add a preference activity into my application but found out that I couldn't make it works. Every time, I tried to start the preference activity but it just crash before showing anything.

Here is the manifest

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

And the preference xml, which I have tried my best to trim it down.

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


</PreferenceScreen>

And finally the preference activity class, which also looks normal to me...

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

    }
}

Thanks in advance if anyone can help.

Jeanno

A: 

Thanks Mathias.

Finally the problem was solved. It seems that I shouldn't call activities from a service. Also, in the method.xml, I should reference to a full package instead of using a local reference.

Jeanno

Jeanno