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 onrecieve ()

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

  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   

This will always give you 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] + "' ');   

With:

  set.add (my_date [i] [j]);    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -