`In my MainActivity3, i use a function lire(), i retrieve DATABASE_NAME
private String lire()
{
SharedPreferences sh = getApplicationContext().getSharedPreferences("Test", 0);
SharedPreferences.Editor editor = sh.edit();
String x1 = sh.getString("Langue", null);
String x2 = sh.getString("Pointdepart", null);
String x3 = sh.getString("NbPoints", null);
String x4 = sh.getString("Bdd", null);
String x5 = sh.getString("CodeBdd", null);
Langue = x1;
DATABASE_NAME = x5;
return DATABASE_NAME;
}
In my SqliteHelpler Class
public class SQLiteHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "lgmfr";
private static Context appContext;
public SQLiteHelper(Context applicationcontext ) {
super(applicationcontext, DATABASE_NAME, null, 1);
this.appContext = applicationcontext;
}
- don't know how to replace DATABASE_NAME = "lgmfr" by DATABASE_NAME from sharedpreferences
Thank's for your help*
question from:
https://stackoverflow.com/questions/65925495/how-can-i-transfer-a-database-name-from-sharedpreferences-to-my-sqliteopenhelper 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…