Write in file .properties in android -
Write in file .properties in android -
i doing application android 2.2, created file config.properties in assets folder, trying modify properties next code:
assetmanager = this.getresources().getassets(); properties pp = new properties(); inputstream isconfig = am.open("config.properties",context.mode_private); pp.load(isconfig); pp.setproperty("shop_url", "new_shop_url");//this key exists seek { pp.store(new fileoutputstream("config.properties"), null); } grab (filenotfoundexception e) { e.printstacktrace(); }catch (ioexception e) { e.printstacktrace(); }
when run application,throw error: java.io.filenofoundexception: read-only file system.
i trying adding permissions solve error,but dont know add.
thanks help
the problem here file path. seek using
try { pp.store(getassets().openfd("config.properties").createoutputstream(), null); } grab (filenotfoundexception e) { e.printstacktrace(); }catch (ioexception e) { e.printstacktrace(); }
this should prepare path problem.
android properties
Comments
Post a Comment