Pergunta

I would like to create the config file on android application and I know for Xcode we use plist, Dot net uses app.config but for android I don't have an idea to create file.

Thank you

Foi útil?

Solução 2

for android application I found the way to create app.properties file, after already app.properties created it's easy to get data from .properties file. Example's below:

public void CreatePropertiesFile(Context context)
{
Properties prop = new Properties();
String propertiesPath = context.getFilesDir().getPath().toString() + "/app.properties";
try {
FileOutputStream out = new FileOutputStream(propertiesPath);
       prop.setProperty("HomeVersion", "0");
prop.setProperty("DatePlaySquare", "0");
prop.setProperty("CustomerID", "0");
prop.setProperty("DeviceToken", "0");
prop.setProperty("CurrentVersionMobile", "0");
prop.setProperty("Domain", "Megazy");
prop.setProperty("DownloadNewVersion","0");
       prop.store(out, null);
       out.close();
} catch (IOException e) {
   System.err.println("Failed to open app.properties file");
   e.printStackTrace();
}

Aey.Sakon

Outras dicas

That good sir is possible by using SharedPreferences.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top