Android examples for java.util:Properties
get one Property from Properties File
import java.io.File; import java.io.FileInputStream; import java.util.Properties; public class Main { public static final String filePath = "cookie.prop"; public static String getProperty(String key) { Properties props = get();//www.jav a 2s . c o m return (props != null) ? props.getProperty(key) : null; } public static Properties get() { FileInputStream fis = null; Properties props = new Properties(); try { File Conf = new File(filePath); if (!Conf.exists()) { Conf.createNewFile(); } fis = new FileInputStream(Conf); props.load(fis); } catch (Exception e) { } finally { try { fis.close(); } catch (Exception e) { } } return props; } }