How to save dynamically added items in Listview with sharedpreferences?

前端 未结 3 1158
青春惊慌失措
青春惊慌失措 2021-01-27 08:14
        protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.a         


        
3条回答
  •  生来不讨喜
    2021-01-27 08:41

    You can save to shared preference in this way

    SharedPreferences sp = context.getSharedPreferences(
                "file name", 0);
        SharedPreferences.Editor spEdit = sp.edit();
        spEdit.putLong(key, value);
        spEdit.commit();
    

提交回复
热议问题