> Thanks very much! I have to say though my (ignorant) questions are
> not over. I am ultra newbie on Java and am not sure how to write a
> (working) Equals method.
I heartily encourage you to learn Java *before* attempting to get into
Android development, simply because most of the Java educational
materials out there are designed for non-Android environments.
> This is the body of the Equals I wrote
> public boolean equals(String strTemp) {
> SharedPreferences
> prefs=PreferenceManager.getDefaultSharedPreferences(this);
> if (strTemp instanceof String) {
> String strP1 = prefs.getString("listPlayers", "");
> if (this.equals(strP1)) return true;
> }
> return false;
> }
There is no point in your instanceof test, as Java is strongly typed,
so it will always be a String. Also, I didn't tell you to *write* an
equals() method, but to *use* the equals() method, as you did inside
your own equals() method.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
_The Busy Coder's Guide to Android Development_ Version 3.6 Available!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment