sharedpreferences

save last position of videoView saved by sharedprefrence and start in last position (android studio)

眉间皱痕 提交于 2020-07-22 04:14:09
问题 save last position of videoView saved by sharedprefrence and start in last position (android studio) hello I serch for my problam in stackaverflow and other refrences but I dont get my answer . I use VideoView In my app I want to save the last position of videview in a sharedPrefrence to start again from the last position but it start in 0 every time please check my code and tel me what should i do. package com.rewass.qurankurdishaudiotranslatev2.activitys; import android.content.Context;

PreferenceManager getDefaultSharedPreferences deprecated in Android Q

你说的曾经没有我的故事 提交于 2020-07-16 16:18:48
问题 PreferenceManager getDefaultSharedPreferences is deprecated in Android Q , how do I replace it? 回答1: You can use AndroidX support library version of PreferenceManager, i.e. androidx.preference.PreferenceManager and not android.preference.PreferenceManager . remember to add the following to your build.gradle. implementation 'androidx.preference:preference:1.1.1' 回答2: Package preference provides the androidx PreferenceManager: Java: implementation "androidx.preference:preference:1.1.1" Kotlin:

Secured Android SharedPreferences Error: 'Caused by: java.lang.RuntimeException: Field keySize_ for…'

人盡茶涼 提交于 2020-07-08 11:09:07
问题 In an Android Kotlin project, I implemented EncryptedSharedPreference feature based on this link using the androidx.security library and it worked well in debug mode. But in release mode, I keep getting this error java.lang.ExceptionInInitializerError at com.package_name.i.a.f(:46) at com.package_name.i.a.j(:52) at com.package_name.i.a.e(:82) at com.package_name.MyApplication.onCreate(:37) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) at android.app

Secured Android SharedPreferences Error: 'Caused by: java.lang.RuntimeException: Field keySize_ for…'

删除回忆录丶 提交于 2020-07-08 11:08:42
问题 In an Android Kotlin project, I implemented EncryptedSharedPreference feature based on this link using the androidx.security library and it worked well in debug mode. But in release mode, I keep getting this error java.lang.ExceptionInInitializerError at com.package_name.i.a.f(:46) at com.package_name.i.a.j(:52) at com.package_name.i.a.e(:82) at com.package_name.MyApplication.onCreate(:37) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) at android.app

How do I pass an Username to another Activity in Android Studio

时光怂恿深爱的人放手 提交于 2020-06-29 04:14:23
问题 I'm currently writing my first App and I want to greet a User by their Name. On the Main acitity I created a Textview called textview_username which i want to "fill" with the users login name. I tried to work with sharedPrefrences but the App keeps crashing when I open the MainActivity. That is the registration page. public class RegisterActivity extends AppCompatActivity implements View.OnClickListener{ EditText username, password; Button show, register, delete; public static final String

Sharepreference to store int value

倾然丶 夕夏残阳落幕 提交于 2020-06-26 12:13:12
问题 I have int value and I want it to increases by 1 when we click positive or negative button of Alert dialogue, and store the int value even when the user closes the app. I've done these but I don't know why is this not working. int counter; in the oncreate initA(); private void initA(){ if(counter < 1) {makeAlertDialogOther();} } private void makeAlertDialogOther() { new AlertDialog.Builder(getActivity()) .setMessage(Constant.SETTINGS.getEntranceMsg()) .setCancelable(false) .setNegativeButton(

Remove Shared preferences key/value pairs

夙愿已清 提交于 2020-06-24 08:26:47
问题 I store some payment values in one Activity SharedPreferences spreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); productId = spreferences.getString("productId", ""); purchaseToken = spreferences.getString("purchaseToken", ""); orderId = spreferences.getString("orderId", ""); Now I retrieve them in another one as SharedPreferences spreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); productId = spreferences.getString(

Convert ArrayList with Gson to String

点点圈 提交于 2020-05-12 15:32:19
问题 I have an ArrayList which contains ArrayLists , each ArrayList in the Root list contains one ArrayList of Integers and one of Strings . I am converting it with Gson to a String to save it with SharedPreferences. But when I am reconverting it, Gson gives me 2.131558489E9 instead of the original int 2131558489 . How can I fix this Problem? Best Regards. Here is how I convert the ArrayList: levelPattern is the ArrayList String levelPatternGson = new Gson().toJson(levelPattern); And this is how I

Convert ArrayList with Gson to String

帅比萌擦擦* 提交于 2020-05-12 15:32:11
问题 I have an ArrayList which contains ArrayLists , each ArrayList in the Root list contains one ArrayList of Integers and one of Strings . I am converting it with Gson to a String to save it with SharedPreferences. But when I am reconverting it, Gson gives me 2.131558489E9 instead of the original int 2131558489 . How can I fix this Problem? Best Regards. Here is how I convert the ArrayList: levelPattern is the ArrayList String levelPatternGson = new Gson().toJson(levelPattern); And this is how I

Convert ArrayList with Gson to String

你离开我真会死。 提交于 2020-05-12 15:26:11
问题 I have an ArrayList which contains ArrayLists , each ArrayList in the Root list contains one ArrayList of Integers and one of Strings . I am converting it with Gson to a String to save it with SharedPreferences. But when I am reconverting it, Gson gives me 2.131558489E9 instead of the original int 2131558489 . How can I fix this Problem? Best Regards. Here is how I convert the ArrayList: levelPattern is the ArrayList String levelPatternGson = new Gson().toJson(levelPattern); And this is how I