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.
我已经声明了一个扩展应用程序的类,以在我的应用程序的活动之间保留一些全局数组变量。当我停止应用程序并再次执行它时,这些值仍然存在,这是我不想要的。所以我想知道当应用程序退出并再次执行时如何重置这些值。
我建议您使用SharedPrefence来创建新类和扩展 Application 类。
使用 SharedPreferences,您可以在应用程序中维护全局数据,也可以在需要时通过一行代码将其删除。
(SharedPrefence)s.edit().clear().commit();