sharedpreferences

How to have an activity that will run once only? [duplicate]

跟風遠走 提交于 2020-01-22 02:30:08
问题 This question already has an answer here : Closed 8 years ago . Possible Duplicate: How do I show an alert dialog only on the first run of my application? In my app there will be a Terms and Conditions activity which shows some conditions along with ok and cancel buttons, and when the user presses 'ok' button the app continue and go on running. Next time when the user starts this app the Terms and Conditions activity must not run as its already accepted before. How to get such a functionality

Android SharedPreferences IOException Error

拈花ヽ惹草 提交于 2020-01-21 11:51:49
问题 So I'm trying to write some strings to SharedPreferences in my android app. I first declare SharedPreferences and its original properties in my Application subclass. I want to be able to change the values of my data in other activities in the app but I get the error below. How should I fix this? Some other guy posted the same question but no one really answered him so that's why I'm asking again. Any help is appreciated! Thanks SharedPreferencesImpl﹕ writeToFile: Got exception: java.io

Call a Fragment in Asyncktask OnPostExecute method

浪子不回头ぞ 提交于 2020-01-17 15:17:33
问题 I have a little problem, I have a AsyncTask where I get a response from the server if the user is registered or not, would that after the call, if the user accesses exist in another fragment, also by storing in a preferences user email, however I have problem when I call getFragmentManager() , could someone help me out? Thank you. This is my code. LoginTask.java public class LoginTask extends AsyncTask<String, Void, User> { public LoginTask() { } @Override protected User doInBackground(String

Using SharedPreferences to share data between two separate Android applications

℡╲_俬逩灬. 提交于 2020-01-17 11:14:25
问题 There will be two separate applications running on an Android device at the same time. We're responsible for App1. Here's what will be happening on the Android device: App1 will be started first, then App2. App1 will display a list of files containing messages. When App2 starts, it will send a 'connect' message to App1. App1 will allow the user to choose a file from the list. When the user presses the 'Run' button, App1 will start sending messages every 3 seconds to App2. App2 will send back

Using SharedPreferences to share data between two separate Android applications

[亡魂溺海] 提交于 2020-01-17 11:14:08
问题 There will be two separate applications running on an Android device at the same time. We're responsible for App1. Here's what will be happening on the Android device: App1 will be started first, then App2. App1 will display a list of files containing messages. When App2 starts, it will send a 'connect' message to App1. App1 will allow the user to choose a file from the list. When the user presses the 'Run' button, App1 will start sending messages every 3 seconds to App2. App2 will send back

Spinner not saving as Shared/Saved Preference

无人久伴 提交于 2020-01-17 06:28:09
问题 Using shared prefernences to save String but having difficulty saving my spinner. public class MainActivity extends Activity { Spinner spnExample; Button btnSave; ArrayAdapter<CharSequence> adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnSave = (Button) findViewById(R.id.btnSave); SharedPreferences prefs; loadData(); spnExample = (Spinner) findViewById(R.id.spnExample); adapter =

What is the correct way to get the value which has been stored using sharedPreferences to widget?

泪湿孤枕 提交于 2020-01-16 08:39:29
问题 What is the correct way to get the value which has been stored using sharedPreferences to widget? PageA @override void initState() { super.initState(); sharedPreferences = SampleSharedPreferences().getData(); sharedPreferences.then((onValue) { name = onValue.name; // I debug this line, I can see the value }); } @override Widget build(BuildContext context) { return Scaffold( body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( child:

Obfuscate/Encrypt SharedPreferences file possible?

流过昼夜 提交于 2020-01-14 13:51:49
问题 So, I'm interested in obfuscating the SharedPreferences xml file of my app, much like Android LVL does to obfuscate it's license cahce data. Would this be conceivable? Plenty of google-digging has yielded little results that might address my question. And I'm certainly no cryptologist. What about other forms of encryption? My end goal isn't to try making the xml bulletproof, I just want to block out the lower 90% of people who would refrain from messing around with it if it's not in plain

Obfuscate/Encrypt SharedPreferences file possible?

白昼怎懂夜的黑 提交于 2020-01-14 13:51:09
问题 So, I'm interested in obfuscating the SharedPreferences xml file of my app, much like Android LVL does to obfuscate it's license cahce data. Would this be conceivable? Plenty of google-digging has yielded little results that might address my question. And I'm certainly no cryptologist. What about other forms of encryption? My end goal isn't to try making the xml bulletproof, I just want to block out the lower 90% of people who would refrain from messing around with it if it's not in plain

What is the difference between Preferences and SharedPreferences in Android?

五迷三道 提交于 2020-01-14 08:58:27
问题 What is the difference between java.util.prefs.Preferences and android.content.SharedPreferences ? Looks like they are for similar things - you can put and get a value by a key in both of them, but Preferences looks like something more difficult and belongs more to the OS than to an app. 回答1: Preferences is a core java class link1 java.util.prefs.Preferences : This class allows applications to store and retrieve user and system preference and configuration data. This data is stored