When my application is started MainActivity is opened.In MainActivity I have a Api call as getApplicationLabels which returns me a JSONObject.I have suppose 5 Fragments in app.The Fragment contains some views as TextView,Edittext having hints etc.The attributes like text,size,color etc of these views need to be set programmatically from String,Color resources. This values I will receive from that getApplicationLabels Api call after Login and will be different for different user. How to add this received values from api into Strings.xml, colors.xml etc and set the labels for all views in app.
Asked
Active
Viewed 59 times
0
Phantômaxx
- 37,901
- 21
- 84
- 115
Satyam Gondhale
- 1,415
- 1
- 16
- 43
-
have u check this https://stackoverflow.com/questions/33987678/programmatically-change-the-value-of-a-color-resource-obtained-from-api-response/33992017#33992017 – AskNilesh Dec 13 '18 at 12:04
-
Create your custom views extending `TextView`, `EditText` etc. make a method there and update views @ runtime. – Jeel Vankhede Dec 13 '18 at 12:05
-
1You **can't add anything** to the `res` folder **at runtime**. – Phantômaxx Dec 13 '18 at 12:25
-
1Perhaps use SQLite and store it in a db instead? – Zee Dec 13 '18 at 12:28