0

taking the values as sharedPrefernece and saving as String ///get date

SharedPreferences shareddate = this.getSharedPreferences("DateInUpcoming", 0);
selectedDate = (shareddate.getString("DateInUpcoming", null));
Log.d("SharedPreference", "DateInUpcoming is "+selectedDate);

Adding double quotes to the string values:

    char ch='"';

    String value = (ch + selectedDate + ch);
    Log.d("SharedPreference",""+value);

The image is also attached from logcat

Any help would be appreciated. This is the result

  • There is no issue with this, you are not adding double-quotes by default its adding. – Swayangjit Nov 02 '19 at 15:34
  • `ch + selectedDate + ch` behaves the way you expect. The braces around it and `""+value` are obsolete. If there's an issue it is already there with `selectedDate` or introduced by `Log.d`. Just [debug](https://stackoverflow.com/questions/25385173/what-is-a-debugger-and-how-can-it-help-me-diagnose-problems?noredirect=1&lq=1) the thing. – Curiosa Globunznik Nov 02 '19 at 16:41

1 Answers1

1

If you are still having the issue, here is a solve -

    String value = ("\"" + selectedDate + "\"");
    Log.d("SharedPreference",""+value);