back soft

مطالب مرتبط با «sharedpreferences not working» در back soft | نویسنده: استخدام کار

SharedPreferences not working when trying to update TextView

Vote count: 0 I'm trying to change a TextView and I want it to be permanent, so I'm using SharedPreferences. Sadly, something is wrong, because the TextView doesn't update. MainService: private void updateUI(Intent intent) { String counter = intent.getStringExtra("counter"); TextView txtCounter = (TextView) findViewById(R.id.txtCounter); assert txtCounter != null; SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(MainActivity.this); SharedPreferences.Editor editor = preferences.edit(); editor.putString(String.valueOf(txtCounter), counter); editor.commit(); } asked 47 secs agoVlad Pintea Let's block ads! بخوانید...

ادامه مطلب

برچسب‌های مرتبط

sharedpreferences not working | sharedpreferences not working across activities | sharedpreferences not saving | sharedpreferences not saving values | sharedpreferences commit not working | sharedpreferences clear not working | android sharedpreferences commit not working | android sharedpreferences remove not working