If I didn't kill app. Its seems ok. Shared preferences object has "email".
When I killed app, Shared preferences empty. 22 Ara 2015 15:08 tarihinde "VISHAL TIKKU" <[email protected]> yazdı: > Then there can only be one case that is preventing execution of the code > ie check for return statement or system.exit or if block is inside any loop > check for break..just dry run it put appropriate debug pointers... > On Dec 22, 2015 6:04 PM, "Cihan KALOĞLU" <[email protected]> wrote: > >> Thank you. >> Tried completely same step. >> >> But it working with all other apps new or existing. >> Just not working with my app. >> 22 Ara 2015 14:14 tarihinde "VISHAL TIKKU" <[email protected]> >> yazdı: >> >>> Its okay no issues.Test case to test this functionality are as >>> follows: >>> 1. In your code write an else block in which provide a toast message and >>> also in your if block provide a different toast message. >>> 2. Clear yours app's cache and data from settings of the phone. >>> 3. Run your code and see if toast comes from if block first. >>> 4. Close your app and run it again see if toast is coming from else >>> block. >>> >>> if points 3 & 4 is achieved then there is no problem in your code, if >>> else block is getting executed when you run your app for the first time >>> find whether your shared preference "rememberme" is been used in any >>> other class where shared preference is getting updated. >>> >>> See if it works. >>> >>> Happy Coding! >>> >>> >>> >>> >>> On 22 December 2015 at 16:24, VISHAL TIKKU <[email protected]> >>> wrote: >>> >>>> Can you share me the complete code of the class in which you have >>>> implemented this shared preference block >>>> >>>> On Monday, December 21, 2015 at 4:08:28 PM UTC+5:30, Cihan KALOĞLU >>>> wrote: >>>>> >>>>> Hi, >>>>> >>>>> I tried all ways how many i know. >>>>> >>>>> That is my code block for test. (MainActivity.onCreate()) >>>>> >>>>> String REMEMBERME_PREF_NAME = "rememberme"; >>>>> SharedPreferences sharedpreferences = >>>>> this.getSharedPreferences(REMEMBERME_PREF_NAME, Context.MODE_PRIVATE); >>>>> if (sharedpreferences.getString("email", "").equals("")) { >>>>> Log.d("SHARED PREF", "onCreate() returned: " + "CAN'T REMEMBER"); >>>>> SharedPreferences.Editor editor = sharedpreferences.edit(); >>>>> editor.clear(); >>>>> editor.putString("email", "REMEMBERED"); >>>>> editor.commit(); >>>>> } >>>>> Log.d("SHARED PREF", "onCreate() returned: " + >>>>> sharedpreferences.getString("email", ":(")); >>>>> >>>>> >>>>> >>>>> >>>>> This code working for all new apps or other existing apps but it still >>>>> doesn't work for my app. >>>>> >>>>> What is wrong with my app? >>>>> >>>>> Could anybody help me? >>>>> >>>>> Thank you. >>>>> >>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "Android Developers" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/android-developers/mE6_1xjrmj8/unsubscribe >>>> . >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> To post to this group, send email to >>>> [email protected]. >>>> Visit this group at https://groups.google.com/group/android-developers. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/android-developers/1eae2e6c-3c7c-4208-915b-207bc0fecc4d%40googlegroups.com >>>> <https://groups.google.com/d/msgid/android-developers/1eae2e6c-3c7c-4208-915b-207bc0fecc4d%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Android Developers" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/android-developers/mE6_1xjrmj8/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To post to this group, send email to [email protected] >>> . >>> Visit this group at https://groups.google.com/group/android-developers. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/android-developers/CAJK-5s_jvq_BF8ETYpLLjcpFu_-NjeoU0ohrsGW%2BQK9zwgCHXw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/android-developers/CAJK-5s_jvq_BF8ETYpLLjcpFu_-NjeoU0ohrsGW%2BQK9zwgCHXw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Android Developers" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/android-developers/mE6_1xjrmj8/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/android-developers. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/android-developers/CAFiLrC5r3mOUJmFUuV2t4ZJgSox5Wn%2BP--NS%2B%3DXZaJ03Qr5K6Q%40mail.gmail.com >> <https://groups.google.com/d/msgid/android-developers/CAFiLrC5r3mOUJmFUuV2t4ZJgSox5Wn%2BP--NS%2B%3DXZaJ03Qr5K6Q%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Android Developers" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/android-developers/mE6_1xjrmj8/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/android-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/android-developers/CAJK-5s_UovfjO_YiQvMJgHLMm5Z4P-Vbct%3DpvCV9eXHGzn-2Xw%40mail.gmail.com > <https://groups.google.com/d/msgid/android-developers/CAJK-5s_UovfjO_YiQvMJgHLMm5Z4P-Vbct%3DpvCV9eXHGzn-2Xw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/CAFiLrC6EqvPhn3UPYiKF6a1HtDsTjw7N6fR6tG7UikOWq2Q34Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

