sharedpreferences

SharedPreferencesListener Stopped working for no apparent reason

时间秒杀一切 提交于 2020-04-18 05:53:05
问题 Simple problem. I made a settingsActivity and made a sharedPrefernecesLIstener . It worked fine so I left it alone to make the rest of my app. I came back to it to finalize some things and found that it stopped working. I looked through some questions on Stack Overflow and read some things but there are no answers. The Log says: W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed. Searching for this doesn't give me an answer because

Flutter One time Intro Screen?

馋奶兔 提交于 2020-04-07 13:14:55
问题 I have a Intro screen for my app,but it shows everytime i open the app, I need to show that for the 1st time only How to do that? //ThIS IS THE SCREEN COMES 1ST WHEN OPENING THE APP (SPLASHSCREEN) class SplashScreen extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> { @override void initState() { super.initState(); //After 2seconds of time the Introscreen will e opened by bellow code Timer

Load SharedPreferences in MainActivity and Update in an secondary activity

偶尔善良 提交于 2020-03-26 07:08:14
问题 Good morning everyone, I'm having problems again in my proccess to create my first app. This time with the SharedPreferences file. I have 2 activities that must use the same SharedPreferences file. The first one is the MainActivity and the second one an edit layout for the data. In the MainActivity I have the following method where I use the data to connect to a PLC: //initialize the SharedPreferences variables for the PLC Data and Connection m_DataPLC = getSharedPreferences("CFTPreferences"

Shared Preferences Android Studio

笑着哭i 提交于 2020-03-22 09:14:28
问题 For the code below I am trying to retrieve the shared preference, I think it saved correctly but when I go back to the login screen all the data is gone. I need it to remain when I go back to this screen. So i enter name, age and id into three separate lines on the profile page. Then i press the save button Then go to the page before by pressing back on the action bar. And when i go back to the profile page my info should still be there but its not Any help? package com.example.myprofile;

How to access flutter Shared preferences on the android end (using java)

房东的猫 提交于 2020-03-19 06:46:27
问题 I have the following function in dart to set a particular boolean preference value. _switchPersistentNotifications() { setState(() { isPersistentNotificationEnabled = !isPersistentNotificationEnabled; }); widget.preferences.setBool( "isPersistentNotificationEnabled", isPersistentNotificationEnabled); } This function sets the value of isPersistentNotificationEnabled preference. Now on the native android end, I am supposed to use this shared preference value. Here's what I have done so far.

How to access flutter Shared preferences on the android end (using java)

扶醉桌前 提交于 2020-03-19 06:46:23
问题 I have the following function in dart to set a particular boolean preference value. _switchPersistentNotifications() { setState(() { isPersistentNotificationEnabled = !isPersistentNotificationEnabled; }); widget.preferences.setBool( "isPersistentNotificationEnabled", isPersistentNotificationEnabled); } This function sets the value of isPersistentNotificationEnabled preference. Now on the native android end, I am supposed to use this shared preference value. Here's what I have done so far.

How to save a string in sharedPreferences

旧时模样 提交于 2020-03-06 09:38:13
问题 I have an application where I need to save a string in a sharedpreferences so that the user has already opened the application once and registered his email he does not have to go through the same screen again and instead go to the home screen directly. My Class PreferencesHelpers public class PreferencesHelpers { private static final String SHARED_PREFS = "sharedPrefs"; private static final String TEXT = "ahhsaushhuuashu"; //I want to save this string public String text; public static void

Get SharedPreferences string value from adapter

狂风中的少年 提交于 2020-03-05 04:23:28
问题 I'm working now with Android Studio 'Java' and I have question about retrieving value from SharedPreferences. I have stored String value in SharedPreferences in the main activity. and now I need to get the value from my Adapter to use it. I tried many solutions but I get errors. this is how I store the value: public void saveAgentId() { SharedPreferences settings = getSharedPreferences("log11",0); String firstRun = settings.getString("agentId", null); if(firstRun == null)//if running for

Android Backup of ENTIRE SharedPreferences file

三世轮回 提交于 2020-02-28 08:38:31
问题 I have been trying to get the backup of my sharedpreferences file in my Android app working and so far it is not. I am using the simple Google code from the developer's guide. Below is the code for the MyPrefsBackup class. public class MyPrefsBackup extends BackupAgentHelper { // The name of the SharedPreferences file static final String PREFS = "UserDB"; // A key to uniquely identify the set of backup data static final String PREFS_BACKUP_KEY = "prefs"; // Allocate a helper and add it to the

Save uri to sharedPreferences and play with mediaplayer

别说谁变了你拦得住时间么 提交于 2020-02-28 05:09:50
问题 This is the code I use to save the string representation of the Uri to the SharedPreferences: public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQ_CODE_PICK_SOUNDFILE && resultCode == Activity.RESULT_OK){ if ((data != null) && (data.getData() != null)){ SharedPreferences sharedPref = getSharedPreferences("customName", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit();