Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 and each value carry one base URL statically.So when user select value from spinner it will access base URL and logging accordingly.Now my question is can I change base URL programmatically in App constant class. so that i do not need to change entire code or make a setting class.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
135 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...