I am currently working on creating an alertdialog box with edittext in it which opens on tap on my login screen , which should allow the capability to update the BASE_URL defined in my gradle. Say for instance I am currently defining my base_url as follows:
buildConfigField("String", "BASE_URL", "\"https://myapp.com/api\"")
which upon running the app translated to a buildConfig URL such that in Buildconfig.java it shows as :
public static final String BASE_URL = "https://myapp.com/api";
Now my question is ,how do I update this base url on the edit text box i add in the alertdialog on the login screen, such that if i change the edit text text to :
https://myapp.com/api2
upon clicking save it should save the new entry and apply it to buildconfig file throughout the course of the app. I also want to display a reset button to allow the capability to reset this URL back to the original. Any ideas how to go about it?
am using a similar code for alertdialog as this : https://medium.com/@mujtahidah/custom-dialog-with-edittext-and-button-action-android-fc64ef5eb2b2
Just want to know if there is a way BASE_URL can be updated in the UI dynamically and saved on the fly? Any ideas or examples? Thanks in advance!