[Nexus S Q&A, Help & Troubleshooting] flab80:
Hello,

i'm trying to add my custom settings to Settings Menù.

I'm trying to add directly from source.

In package settings i'm creating my package com.android.settings.toggles and add a class named DevSettings.java

In this Java file i've added this strings:

package com.android.settings.toggles;

import android.os.Bundle;

import android.preference.Preference;

import com.android.settings.R;

import com.android.settings.SettingsPreferenceFragment;

public class DevSettings extends SettingsPreferenceFragment {

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

addPreferencesFromResource(R.xml.rom_settings);

}

}

then i compiling with make Settings.apk and file correctly created.

I'll transfer it to phone but when i click to related voice Settings crash with this error:

14:31:17.626 Error AndroidRuntime 2961 FATAL EXCEPTION: main

14:31:17.626 Error AndroidRuntime 2961 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.SubSettings}: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.android.settings.toggles.DevSettings: make sure class name exists, is public, and has an empty constructor that is public

14:31:17.626 Error AndroidRuntime 2961	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)

14:31:17.626 Error AndroidRuntime 2961	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)

14:31:17.626 Error AndroidRuntime 2961	at android.app.ActivityThread.access$600(ActivityThread.java:130)

14:31:17.626 Error AndroidRuntime 2961	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)

14:31:17.626 Error AndroidRuntime 2961	at android.os.Handler.dispatchMessage(Handler.java:99)

14:31:17.626 Error AndroidRuntime 2961	at android.os.Looper.loop(Looper.java:137)

14:31:17.626 Error AndroidRuntime 2961	at android.app.ActivityThread.main(ActivityThread.java:4745)

14:31:17.626 Error AndroidRuntime 2961	at java.lang.reflect.Method.invokeNative(Native Method)

14:31:17.626 Error AndroidRuntime 2961	at java.lang.reflect.Method.invoke(Method.java:511)

14:31:17.626 Error AndroidRuntime 2961	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)

14:31:17.626 Error AndroidRuntime 2961	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

14:31:17.626 Error AndroidRuntime 2961	at dalvik.system.NativeStart.main(Native Method)

14:31:17.626 Error AndroidRuntime 2961 Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.android.settings.toggles.DevSettings: make sure class name exists, is public, and has an empty constructor that is public

14:31:17.626 Error AndroidRuntime 2961	at android.app.Fragment.instantiate(Fragment.java:584)

14:31:17.626 Error AndroidRuntime 2961	at android.preference.PreferenceActivity.switchToHeaderInner(PreferenceActivity.java:1125)

14:31:17.626 Error AndroidRuntime 2961	at android.preference.PreferenceActivity.switchToHeader(PreferenceActivity.java:1141)

14:31:17.626 Error AndroidRuntime 2961	at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:532)

14:31:17.626 Error AndroidRuntime 2961	at com.android.settings.Settings.onCreate(Settings.java:135)

14:31:17.626 Error AndroidRuntime 2961	at android.app.Activity.performCreate(Activity.java:5008)

14:31:17.626 Error AndroidRuntime 2961	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)

14:31:17.626 Error AndroidRuntime 2961	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)

14:31:17.626 Error AndroidRuntime 2961	... 11 more

14:31:17.626 Error AndroidRuntime 2961 Caused by: java.lang.ClassNotFoundException: com.android.settings.toggles.DevSettings

14:31:17.626 Error AndroidRuntime 2961	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)

14:31:17.626 Error AndroidRuntime 2961	at java.lang.ClassLoader.loadClass(ClassLoader.java:501)

14:31:17.626 Error AndroidRuntime 2961	at java.lang.ClassLoader.loadClass(ClassLoader.java:461)

14:31:17.626 Error AndroidRuntime 2961	at android.app.Fragment.instantiate(Fragment.java:574)

14:31:17.626 Error AndroidRuntime 2961	... 18 more

Could someone help me? Thanks