views:

246

answers:

2

I would like to have a checkbox preference that takes the user to a new (sub)preference screen if the user presses on the actual text (and not on the checkbox to the right).

Just as the control under Settings -> Wireless -> Mobile Network Settings -> Access Point Names.

A: 

On my Nexus One, there is no checkbox on the Access Point Names preference. It is also not on the Android 2.1 emulator, the Motorola CLIQ, the Google Ion, or the T-Mobile G1.

The pattern that you describe would seem to violate the way the preference UI is set up.

That being said, if you do find a preference built into Android that behaves the way you want, you can go find it in the open source code. Many of the preferences used by Settings are not part of the public API, but you can clone their implementation into your own project.

CommonsWare
Thats weird. I have it both in the emulator and on my hero. When I come to think of it it's actually a radio-button (for selecting the APN) but I'm after the same thing but for a check-box.
aioobe
A: 

Two possibilities:

1) You can get android source code and see how they do it.

2) Check options in this question. I was trying to move to an specific DialogPreference. I your particular case I think it's better to create and show a new Dialog.

Macarse
Thanks! I found the code for the APN-PrefreneceActivity right away at http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob;f=src/com/android/settings/ApnEditor.java;h=62856d119e7a7ec5f15c0c30ebc1a5776dc3b3ef;hb=HEAD
aioobe