如何有将仅运行一次的活动?有将仅

2023-09-04 06:10:43 作者:你是水果味儿的

可能重复:   How我只显示在我的应用程序第一次运行一个警告对话框?

在我的应用程序将有条款和条件的活动,显示以及确定一些条件和取消按钮,当用户presses确定按钮的应用程序,继续,继续运行。当用户启动这个下一次应用程序的条款和条件的活动绝不能运行其已经接受了。如何获得这样的功能在我的应用程序?

In my app there will be a Terms and Conditions activity which shows some conditions along with ok and cancel buttons, and when the user presses 'ok' button the app continue and go on running. Next time when the user starts this app the Terms and Conditions activity must not run as its already accepted before. How to get such a functionality in my app?

我不想使用共享preferences或内部应用程序的内存。我想自定义的发射活动的意图。

I don't want to use shared preferences or internal app memory. I want to customize the launch of intent between activities.

推荐答案

为什么你不希望使用共享preferences?这将是迄今为止最容易。当然,你能想到的,不要使用共享preferences更复杂的方式,但你必须存储在某个地方。一些混乱的方式:

Why don't you want to use the shared preferences? This would be by far the easiest. Of course you can think of more complicated ways that don't use shared preferences, but you have to store it somewhere. Some messier ways:

使用SQLite数据库 使用自己的文件格式 使用一个唯一的设备ID(小心,Android的ID是不是真的唯一的),并将其存储在远程服务器上 将其存放在一个非常疯狂的方法,如特殊的文字信息,或联系人,或者... 找到一些方法来改变你的应用程序code(也许可以在一个植根电话?)

要总结:共享preferences由这种类型的东西。有用。用它。没有真的。

To summarize: SharedPreferences is made for this type of thing. It works. Use it. No really.

相关推荐