How to store json object to shared preferences?

前端 未结 8 1329
栀梦
栀梦 2020-12-21 22:53

I am creating an application,In my app I am getting response and displaing it in custom alert dialog, Till here it works fine, Now what I am trying to do is if user selects

8条回答
  •  执笔经年
    2020-12-21 23:26

    Data for states does not change for years so you can keep this json data in assets and use it from there or keep it in a static map. instead of calling webservice to fetch it.

    for persisting the selected value, you can use SharedPreferences and store state id in it. next time whenever you inflate list of states you can check in your shared preference and select the one which is saved.

提交回复
热议问题