Skip to content Skip to sidebar Skip to footer

How Can You Add To Network_security_config From Mainactivity

I have an app I get some values from a webserver per OkHTTP, which works and it displays it on MainActivity. Now I want to add those recieved values to network_security_config.xml

Solution 1:

From your question it appears that you want to save your string for a later use, so you can use SharedPreferences to save the String for later use.

finalStringTAG="some final text";
sharedPref = newSharedPreferences();
sharedPref = getSharedPreferences(TAG,Context.MODE_PRIVATE);
    SharedPreferences.Editoreditor= sharedPref.edit();

    editor.putString("key","your_string");
    editor.apply();

Later on, you can retreive your string from SharedPreferences when you run your app again as follows

Stringvalue= sharedPref.getString("key","default_value");

Post a Comment for "How Can You Add To Network_security_config From Mainactivity"