Skip to content Skip to sidebar Skip to footer

How Can I Make Base Url Dynamically In Appconstants Class

I have an existing old project where only one base URL is defined statically in app constant class. Now I need to implement a spinner in login activity which have 3 spinner value a

Solution 1:

As per my understanding you need to implement a spinner in an existing project which is having 3 static value and each value carry a different path for logging.

First thing as per my understanding you can't make Base URL dynamically because it's constant class.

Now coming to your point if I understand you correctly, you can get URL on spinner item select in logging activity and if logging result is success then save URL value in Sharedpreference so that you can get this value in all your activity from Sharedpreference.

Remember this will get you only one path.

Solution 2:

If i undrestand you correctly, you want to modify an existing or add a new variable, that was declared as final static ? With reflection you can modify constants also.

Post a Comment for "How Can I Make Base Url Dynamically In Appconstants Class"