Working through java/android learning curve... I created a text file where I want to keep all the settings for my app. Reading these from the file is working OK. Now, how could I simply use these three values in other classes? Thanks in advance!
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
bind = ActivityHomeBinding.inflate(getLayoutInflater());
setContentView(bind.getRoot());
ReadConfigFile();
initView();
}
public static void ReadConfigFile() {
try (FileInputStream fis = new FileInputStream("/storage/emulated/0/Download/suivicourse.cfg")) {
Properties prop = new Properties();
prop.load(fis);
String sc_url = prop.getProperty("database.url");
String sc_user = prop.getProperty("database.username");
String sc_pswd = prop.getProperty("database.password");
System.out.println(sc_url);
System.out.println(sc_user);
System.out.println(sc_pswd);
} catch (IOException e) {
e.printStackTrace();
}
}