sharedpreferences

Problem in Shared Preferenced in LoginScreen. Flutter

断了今生、忘了曾经 提交于 2019-12-20 06:06:05
问题 help and explain to me in detail please how can I modify my code. I am beginner in Flutter and now I am doing tasks, the essence of which is the use of Shared Preferenced in the Login Screen and saving the user data in FireBase. When the user first entered the data, he entered the Home screen, but when the user exits the application and tries to log in again, it should be that he does not need to enter the password and login again. Also, I knocked out such an error import 'package:flutter

get previous/next day Date on button press after getting date from previous activity using SharedPreferences android

无人久伴 提交于 2019-12-20 05:11:12
问题 In my application I am Using this library for Custom Calender View. On click any date i am passing that date to next activity through shared preferences. I am able to display date in next activity. Now what i want is there are two buttons, one is "Previous" and another one "Next". if i click on any button date has to change according to requirement. Onclick date code is calendarView.setOnDateClickListener(new CalendarView.OnDateClickListener() { @Override public void onDateClick(@NonNull Date

how to save togglebutton state using shared preferences [closed]

最后都变了- 提交于 2019-12-20 02:08:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . how to let this toggle button state to be saved and used in all my activities using shared preferences, I put the shared preferences code but this one don't work so is there something i missed or this code is fault this is the new code and the whole class code please check it, maybe something effect the code

Save SharedPreferences files into custom dir or get default SharedPreferences dir

六月ゝ 毕业季﹏ 提交于 2019-12-19 17:43:26
问题 Is it possible to save SharedPreferences files into custom dir? Let's say into /data/data/package.name/my_prefs/ . Or is it possible to retrieve the directory SharedPreferences are saved by default to? P.S. Hardcoding the path /data/data/package.name/shared_prefs/ is not the solution. 回答1: Or is it possible to retrieve the directory SharedPreferences are saved by default to? Yes. This is basically the dataDir /shared_prefs which you can get from the ApplicationInfo object (which in turn you

Android - Setting and Fetching a StringSet from SharedPreferences?

二次信任 提交于 2019-12-19 15:25:32
问题 Good day, I am building an Android Application. I want to store a set of strings in the Preferences to order to track who used the application based on their log in information. I don't want to use a database so I know that I should use SharedPreferences to store a list of people who logged in. I want to be able to reset this list so keeping the individual log in data as Strings and NOT as StringSets is not an option. Using individual Strings means that I'll have to keep another list of those

SharedPreferences getString returns null though set by editor in AsyncTask

时光总嘲笑我的痴心妄想 提交于 2019-12-19 10:59:10
问题 I have a LoginActivity which calls an AsyncTask to post username and password to the server and on response, it will write username to SharedPreferences (can retrieve the username from SP here) and return to may app's MainActivity . However, I retrieve the username from SP in MainActivity , it is null . Where did I do wrong? AsyncTask code: //activity is the context passed from LoginActivity (using "this") protected void onPostExecute(String result) { if(result!=null){ try { JSONTokener

Xamarin Forms Sharedpreferences cross

瘦欲@ 提交于 2019-12-19 05:17:41
问题 I'd like to know what is the best solution to manipulate application settings in a cross-platform way. In iOS we can change the settings outside the app in the settings screen, but we don't have that in windows phone and android. So, my idea is to create a normal page/screen inside the app that shows all my application settings and have an interface with Save() and Get() methods that I can implement specific per device using DependencyServices. Is this the right way to do it? 回答1: The

Difference Between commit and apply in Android SharedPreferences [duplicate]

三世轮回 提交于 2019-12-19 05:04:25
问题 This question already has answers here : What's the difference between commit() and apply() in Shared Preference (8 answers) Closed 6 years ago . SharedPreferences are used to save Application data in Android. commit() and apply() both are used to save the changes in the shared preferences. As mentioned in Android Library: public abstarct void apply(): Unlike commit(), which writes its preferences out to persistent storage synchronously, apply() commits its changes to the in-memory

SharedPreferences & boolean

最后都变了- 提交于 2019-12-19 04:38:29
问题 I'm trying to set the "isPhysicalTheftEnabled" to false when a method is executed, but this doesn't seem to work. Anyone have any idea? SharedPreferences sp = getSharedPreferences("isPhysicalTheftEnabled", MODE_WORLD_READABLE); SharedPreferences.Editor ed = sp.edit(); ed.putBoolean("isPhysicalTheftEnabled", false); 回答1: Try adding ed.commit() . i.e.: SharedPreferences sp = getSharedPreferences("isPhysicalTheftEnabled", MODE_WORLD_READABLE); SharedPreferences.Editor ed = sp.edit(); ed

Add several appWidgets with different configuration?

寵の児 提交于 2019-12-19 04:05:18
问题 I've created a widget which displays a simple textview, which is editable as an Edittext in a configuration activity. I save the inputted text with shared preferences, so the user can tap the widget to edit the text, and the already inputted text appears in the edittextfield. My problem is this. I would like the user to be able to add multiple widgets, but when a seccond widget is added, the same text as in the other widget is loaded from shared preferences. And, when on widget is edited so