Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何创建一个记住 id 和内容的列表适配器?
我希望在初始化适配器时,向它提供一个映射,其中 id 作为键,内容作为值,而不仅仅是一个字符串列表。
我必须对什么进行子类化,以及我为构造函数添加了什么?
您可以使用 sharePreferneces 进行尝试。它试过了,对我来说效果很好。
SharedPreferences myPrefs = this.getSharedPreferences("myPrefs", MODE_WORLD_READABLE); SharedPreferences.Editor prefsEditor = myPrefs.edit(); prefsEditor.putInt(key,value); prefsEditor.commit();