android - how to match string stored in shared preferences with current date -
In my app, I am storing a 2 dimensional array using shared prefens, which now has dates on date Saving a complete public void does not give me any errors, but when I match the current date with the array, it always looks wrong What is the date and if it does not go into condition then This will always give you With: onrecieve ()
string [] [] my_date; Set up & lt; String & gt; check date; / * Gets the date of today and it is covered in the string / calendar calendar = calendar.Just instant (); int todaysDate = cal.get (calendar. DAY_OF_MONTH); String cDate = integer Trusting (today's day); Shared references pref = arg0.getSharedPreferences ("MyPref", 0); // 0 - SharedPreferences.Editor Editor for Private Mode = pref.edit (); Set up & lt; String & gt; Set = new hashset & lt; String & gt; (); (For int i = 0; i
false . You put the number set of the day with apostrophes. Therefore, there will be items in your
set :
'1', '2', '3' . There are no such apostrophes that represent
string
cDate , so
String.valueOf (1) is not equal
"1" '". Try changing it:
set.add ("'" + my_date [i] [j] + "' ');
set.add (my_date [i] [j]);
Comments
Post a Comment