Adding new entries in the Settings app

1,264 views
Skip to first unread message

mvniekerk

unread,
May 28, 2009, 4:49:25 AM5/28/09
to android-platform
I'm busy with the Cupcake source and trying to add entries to the
Settings app. When I click on my entry in the Settings app, it asks me
"Complete Action using" - not just opening the intent as it should.
Scrolling down the list I do see my intent (and clicking on that item
does open the correct intent).
Thus, normally it should be
Settings->Sip Settings->Account Settings->Registrar
But it is now
Settings->Sip Settings->(Complete Action using -> Sip Settings) ->
Account Settings -> Registrar

In /frameworks/apps/Settings/res/xml/settings.xml I've added the
following:
<!-- SIP Settings -->
<PreferenceScreen
android:key="sip_settings"
android:title="@string/sipSettings_menu_sipSettings"
android:summary="@string/sipSettings_menu_sipSettings">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.settings"
android.targetClass="com.android.settings.sip.SipSettings"/>
</PreferenceScreen>

In /frameworks/apps/Settings/AndroidManifest.xml I've added the
following:
<activity android:name=".sip.SipSettings"
android:label="@string/sipSettings_menu_sipSettings"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.SIP_SETTINGS" /
>
<category
android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

All the strings are added to /res/values/strings.xml

In /frameworks/apps/Settings/src/com/android/settings/sip/ I've added
the class SipSettings (SipSettings.java) that extends
PreferenceActivity.

Any help would be greatly appreciated.

mvniekerk

unread,
May 28, 2009, 8:26:25 AM5/28/09
to android-platform
OK, I've fixed it.

Just for future reference for anyone that may have the same problem,
I'll describe my solution.

In your AndroidManifest.xml file, make sure that you write the whole
package name of your custom class. Make also sure that there is
another intent action listed other than MAIN.
For example:
<activity android:name="com.android.settings.sip.SipSettings"
android:label="@string/sipSettings_menu_sipSettings"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action
android:name="com.android.settings.SIP_SETTINGS" />
<category
android:name="android.intent.category.DEFAULT" />
<category
android:name="android.intent.category.VOICE_LAUNCH" />
</intent-filter>
</activity>

Then, in the preference screen that you are going to call this, call
it by the other action. Mine was at the front settings screen (that
uses the /res/xml/settings.xml file for its layout):
<PreferenceScreen
android:title="@string/sipSettings_menu_sipSettings"
android:summary="@string/
sipSettings_menu_sipSettingsDescription">
<intent
android:action="android.intent.action.SIP_SETTINGS"
android:targetPackage="com.android.settings"

android:targetClass="com.android.settings.sip.SipSettings" />
</PreferenceScreen>

Then it works. Maybe there is a bug in here somewhere, Google?
Reply all
Reply to author
Forward
0 new messages