Most voted "sharedpreferences" questions
A Sharedpreferencesobject points to a file containing pairs of key values and provides simple methods to read and write them. Each Sharedpreferencesarquivo is managed by the structure and can be private or shared. source: https://developer.android.com/training/data-storage/shared-preferences
Learn more…47 questions
Sort by count of
-
10
votes1
answer3183
viewsSave value in Sharedpreference
How I do to save and recover information in an Android Prefence file. Example String a = "stack overflow" int b = 32; boolean c = true;
-
6
votes2
answers2292
viewsHow to save a list of elements with Shared Preferences
I am creating a contact list and would like to save this list with Sharedpreferences. Example: public class MeusContatos extends Activity implements OnClickListener { int pos=0; public static final…
-
4
votes1
answer419
viewsData persistence levels in android applications
I’m studying persistence for android, however I’m having difficulty understanding the levels of persistence they make in applications. I saw that there are 5 types: onSavedIntanceState…
-
3
votes1
answer66
viewsQuestions on In App Purchase Android
I have two questions on In App Purchase... First wanted to know what it would be like to hide the key64 that talks in the test application you have in Android Studio, because it is not recommended…
-
2
votes1
answer244
viewsIs there a session variable in Json [web service]?
Well, the mini world of my project is as follows:: I am creating an application, where I will consume a database by the json method, where I validate the logged-in user, however when I am asked to…
-
2
votes1
answer56
viewsShared Preferences Android Stidop
I had to watch a tuturial on youtube and copied this code to save and delete entered values, my doubt is that always appears that "0" as below and I would like to know how I can takeit without…
-
1
votes1
answer95
viewsHow to add multiple numbers in Sharedpreferences and always keep the instance of Sharedpreferences?
I needed to add a data in Sharedpreferences and it will wipe out all the data, not "zero" plus my data. I am using the editor.putStringSet("data", dado); to store my data, I needed to keep this data…
-
1
votes0
answers42
viewsSelect cities with Sharedpreference
Only when I click on "Itaborai" that saves the preference, how do I select the other items in the list view among other activitys? As an example, the customer clicked on "Itaborai" when he opens the…
-
1
votes1
answer668
viewssharedpreferences in the first Activity, show only once?
I’m developing an app in which you will have the first Activity greeting, and I want to show it only once, only when the app first opens. In this case, I created a Activity calling a layout…
-
1
votes3
answers1124
viewshow to show data from a sharedPreferences in a Listactivity
I’m starting to work with Sharedpreferences on android, a simple and fast way to store static and primitive data. However, my problem is showing these values stored in a Listactivity. I’ve looked…
-
1
votes2
answers1618
viewsHow to use sharedpreferences as a class
I would like to know how I do to receive a data and assign it in a class of SharedPreferences, so that I can use this value whenever I need. Follow below my codes and where I need you to change.…
-
1
votes1
answer63
viewsAndroid - Share Preferences for another device
My question is the following: it is possible to share information saved by Sharedprefences to another device, either by bluetooth or another connection ? Mainactivity.java: SharedPreferences.EDITOR…
-
1
votes1
answer74
viewsShared preferences saving whole wrong
I am saving the user code (an integer) in Shared preferences: String a = Integer.toString(pUsuario.getCodigo()); SharedPreferences.Editor editor_Codigo = oCodigo.edit();…
-
1
votes1
answer82
viewsError searching for Information in Sharedpreferences Android
I have an android application, and in it I keep some basic user information in Sharedpreferences, but started to show the following error parse JSON: java.lang.Illegalstateexception: Expected…
-
1
votes1
answer53
viewsHow can I separate items from a sharedPreferences into an Array?
I have a question, I made a checkbox on items in a listview that when marked are stored as Sharedpreferences. So I created a button (Favorites) to access the items marked by the checkbox, but the…
-
1
votes2
answers369
viewsPassing parameter to another Activity with sharedPreference
I have a code where I will access a webservice that will be changing the ip weekly, I created a sharedpreference for the user to save the new ip and when saving my Activity would pull this IP saved…
android web-service checkbox edittext sharedpreferencesasked 7 years, 3 months ago Renato Crispim 45 -
1
votes0
answers90
viewsAndroid: Error in getcontext() when using Sharedpreferences
I’m using SharedPreferences with Retrofit2 and notificações. Each time the Notification is executed I get the exception "'java.lang.String android.content.Context.getPackageName()' on a null object…
-
1
votes0
answers50
viewsHow do I share data across multiple apps?
I have apps A, B, C and D and I need to share data from these apps, for a specific app (And) (Basically login data, to log in automatically. As Messenger does, retrieving access data from Facebook).…
-
1
votes1
answer64
viewsHow to use Sharedpreferences from Android in this case?
I am trying to save a display state, where when you press the robot button, a message "True" appears and changes the icon to a person and when I press the person’s icon back to the robot icon and…
-
0
votes1
answer1743
viewsUse a variable in an Activity declared in another Activity
In my application I have a Sharedpreference variable that stores an int value for me. This value has to decrease as the user performs some actions, as if it were a counter. Let’s say that each time…
-
0
votes1
answer58
viewsSharedpreference calling an Activity
If I want to put a sharedpreference on a button, in case to select the desired city in a list view, how would it be? Because I only find sharedpreference with login etc.
-
0
votes1
answer62
viewsConditional Change of Activity
Hello, I have a problem, I want to create a conditional on an Activity, inside a button, to open another Activity in my app. But how would that parole? My app has buttons in main Activity that leads…
-
0
votes0
answers86
viewsHow to choose a gallery video to be default and always play?
I am working on a program that is interactive with users. With this, the user can choose image or take a photo and replace with the one that was in ImageView. When you click on ImageView, a video of…
-
0
votes1
answer226
viewsPass data between Activity Android
I’m new to programming for android, and I just made my first app, but I’m having a problem, which is: My game has the start menu with the button to start the game and the information about the high…
-
0
votes1
answer121
viewsHow to use Sharedpreferencesfrom Android? Can I choose several filenames?
I’m learning to use android by making an example application with various types of functions of Android Studio. At the moment I have a list presented in a Listview and I would like to save it. I use…
-
0
votes0
answers163
viewsShared Preferences - Error in some cell phones
Is there a reason for an application that uses Shared Preferences to work on only a few phones? Yes, the reason the particular application stops working on some phones is the Shared Preferences. If…
-
0
votes0
answers44
viewshow to use sharedpreferences
Good afternoon can anyone give me an example of how to create sharedpreferences... I’m in a bad situation where .. i validated the user and password on the server using php via webservice and after…
-
0
votes1
answer48
viewsSave content to your phone
I am making an application, where I have a list of questions, and if the user leaves the application or screen, I would like to save the questions he already answered, so when he goes back to that…
-
0
votes1
answer96
viewsWhere do I find logs like login and password stored in the xml that Sharedpreference does?
I wanted to find the file path because I want to confirm if my function encrypted this data.
-
0
votes1
answer304
viewsWhich method to use Sharedpreferences best?
I have an application with a webview in which a token returns when the user logs in. I need to save the user information to perform the auto-login the next time he logs in, I intend to do so using…
-
0
votes1
answer109
viewsHow do I maintain and display Countdown when leaving the app?
I’m building an app to run tasks every hour, and I want to show countdown. But when I exit the app, when I return, the countdown restarts. I need that when I return to the app, the countdown is…
-
0
votes1
answer54
viewsEvent onClick with Android Preferences
I have some preferences within the PreferenceScreen in the archive xml/preferences.xml. These are some items that I need to be shown to the user. See below: <Preference…
-
0
votes1
answer220
viewsHow to pick up an item from the return of a json
I would like to know how to store each separate item so I can use it later in one sharedpreferences. There is this class in my program .... public class Tab { private String UC; private String…
-
0
votes2
answers275
viewsHow to create a configuration screen in an Android app that appears only at the time of user registration?
I’m developing an app android with Firebase authentication, I need to put a screen in which the user will define a "nickname", but it must be immutable. So, this screen needs to appear right after…
-
0
votes1
answer134
viewsCan I use JSON to save Arraylists in Shared Preferences?
I’m developing an app on a college project and I’m creating the control part, I won’t mess with the server part for now because I don’t know much about. I’m creating functions to generate some…
-
0
votes1
answer195
viewsHow to recover the status of a button with Sharedpreferences on Android/Kotlin on multiple screens?
Friends, I have two activitys, at first I have a sound button on and off and at second I have some buttons like a name button A and when clicked it should know what the state of the sound button is…
-
0
votes1
answer61
viewsHow to use Sharedpreferences access modes?
When we use Sharedpreferences, we have for example: SharedPreferences prefencias = getSharedPreferences(nome, modo); Where "name" is the name of the preference and "mode" indicates the permission…
-
0
votes1
answer1814
viewsKeep login active on flutter
I want when the user logs in, even if the application is still logged in. I am using an own api made in Nodejs. Through my researches I saw that you can do this using the plugin Sharedpreferences.…
-
0
votes0
answers28
viewsIs sharedpreferences indicated to save the application status?
I’ve searched several gringo sites but found nothing, including here. I have a problem in the application that whenever the user minimizes it and uses the mobile phone for something else on cell…
-
0
votes0
answers77
viewsWhen trying to get the user id saved in sharedPreferences, sometimes it returns null
When logging into the app, I save your data to Sharedpreferences using GSON (to save the API response with id, name, email, etc). The problem is that when starting the app, I check if the Model User…
-
0
votes1
answer462
viewsHow to store more than one value using Sharedpreferences?
I’m making an app where I created a checkbox to represent a favorite item. The problem I’m having is that when I put more than one item as a favorite, the last one replaces the first one, that is,…
-
0
votes0
answers36
viewsSharedpreferences receiving Nullpointerexception
I need some help with Sharedpreference. I am developing a phrase APP, where there is a checkbox that marks favorite phrases and plays these phrases in Sharedpreferences where they can be accessed…
-
0
votes1
answer141
viewsNull appears instead of the recovered name
When seeing the application, I see that in the variable nomedoHumano appears null, and the user’s name should appear. Just below the method Onclick, recover the name typed. I’ve thought about…
-
0
votes1
answer94
viewsPreferences created in Android Studio with connection to Firebase is not persisting
We have just started to develop an application. We have opted to connect to the Firebase database using email user and password. Logging in and creating new users is working normally, however, my…
-
0
votes1
answer118
viewsUsing Sharedpreferences to get the default setting in Flutter
Good morning I’m starting to study Flutter and I was trying to create a Configuration screen, where after configuring the parameters on the screen, you can search at any time, and for this I’m using…
-
-1
votes1
answer197
viewsHow to save value correctly in Sharedpreferences? - Flutter
Hello, everybody! Where am I going wrong? I have login with google to pick up the token and send to graphgl. This token is saved - at least that’s what it should be - in sharedpreferences, but it’s…
-
-1
votes0
answers13
viewsShared Preferences does not work
I’m making an application where in the database makes a summation, along with an innerjoin After running this selection, I want it to save the values in a Shared preferences. But always when I try…