アンドロイドで、PC用のiniを読み込んで使えないかなと気になったのでやってみた。アンドロイドでの設定の保存のやり方はSharedPreferencesやDataStoreを行うようだ。
PC用のiniはPropertiesで読み込めた。propをSharedPreferencesに変換して保存した。
prop = new Properties();
InputStream isini;
try {
isini = this.getAssets().open("AozoraEpub3.ini");;
prop.load(isini);
} catch (IOException e) {
e.printStackTrace();
}
SharedPreferences dataStore = getSharedPreferences("DataStore", MODE_PRIVATE);
SharedPreferences.Editor editor = dataStore.edit();
Enumeration keys = prop.keys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
String value = (String)prop.get(key);
System.out.println(key + ": " + value);
// Key: input, value: text
editor.putString(key, value);
}
//editor.commit();
editor.apply();
Device File Explorer でDataStore.xmlに保存されている内容を確認すると。