PreferenceActivity Error

mjtaryan

Active Member
Licensed User
Longtime User
I created a "Settings" button for the popup menu and used the code Erel gave in the PreferenceActivity tutorial to open the Settings. When tap the button I get a message that says the app has stopped unexpectedly and has a Force Close button.

I don't know why. I've been using the tutorial as a template for creating my own settings / preferences. I got the PreferenceScreen created and was merely truing to display it. The app compiles without error. So, I need some help in debugging this.

I have a couple of lists among the preferences. Therefore, my first question is do the values passed to the AddList method need to be literals or can they be in their own list? For example, I've created

Dim lstColors as List
lstColors.Initializee
lstColors.Add("Red")
lstColors.Add("White")
lstColors.Add("Blue")

Having created such a list can I do the following?

Dim MyPrefs as PreferenceScreen
MyPrefs.Initialize("Colors")
MyPrefs.AddList("Clrs", "Colors", "Choose a color", "Red", lstColors)

Thanks.
Mike

PS Hold off on replying. I think I may have discovered a silly error that may have resulted in the force close. (I wanted to delete this message, but couldn't find the delete button when I came back to edit it. Sorry -- I guess I'm in too much of a hurry and overlook stuff.

PPS Yep, not only did I make a silly mistake (forgot to actually call the sub that creates the list and then the PreferenceScreen, but when I looked at the PreferenceScreen after compiling I got an answer to my question about the values and using a list. But now I have another question, which I will ask in a new post. Thanks. Sorry for the bother.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…