how to use Properties and File to Save Data
the file is saved to /data/data/yourappname/files
//new a Properties object
//show how to load value
Properties properties = new Properties();
try{
FileInputSteam stream = this.openFileInput("filepath.cfg");
properties.load(steam);
}catch (FileNotFoundException e)
{
}catch(IOException e){
}
Boolean bValue = Boolean.valueof(properties.get("bValueName").toString());
//show how to store value
Properties properties = new Properties();
properties.put("bValueName",String.valueOf(bValue));
try{
FileOutputStream steam = this.openFileOutput("filepath.cfg",Context.MODE_WORLD_WRITEABLE);
properties.store(steam,"");
}catch (FileNotFoundException e)
{
}catch(IOException e){
}
sharing files/data between two apps.
the file is saved to /data/data/yourappname/files
//new a Properties object
//show how to load value
Properties properties = new Properties();
try{
FileInputSteam stream = this.openFileInput("filepath.cfg");
properties.load(steam);
}catch (FileNotFoundException e)
{
}catch(IOException e){
}
Boolean bValue = Boolean.valueof(properties.get("bValueName").toString());
//show how to store value
Properties properties = new Properties();
properties.put("bValueName",String.valueOf(bValue));
try{
FileOutputStream steam = this.openFileOutput("filepath.cfg",Context.MODE_WORLD_WRITEABLE);
properties.store(steam,"");
}catch (FileNotFoundException e)
{
}catch(IOException e){
}
sharing files/data between two apps.