• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ListPreference problem

 
Evas Stank
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I have create a ListPreference in preference.xml:

I have call preference.java like that:

I cant get the value of ListPreference when I change the value. I do like that:

ListPreference arrays.xml:

If I change the value to "2" nothing happens.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

if (ListPreference == "2")

Strings are compared using the equals method, not using the == operator.
 
Evas Stank
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ulf Dittmer. That resolve my problem.
 
mark goking
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also, that should be ListPreference.equals("2")
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic