Android警报消失

时间:2012-07-31 18:57:27

标签: android browser bitmap alert

我在我的应用中发了警报 它在我想要它的主要活动中是完美的 但是我希望它在三次警告之后就消失了......不是每次我回到它出现的主要活动

这是我的提醒代码

        new AlertDialog.Builder( this )
    .setTitle( "Browser feature" )
    .setMessage( "The browser feature is currently beta, so it won't work perfectly. To get an image from the internet, click on the browser then google your image, and save it then import it using the gallery option." )
    .setPositiveButton( "Continue", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            Log.d( "AlertDialog", "Positive" );
        }
    })
    .show();

1 个答案:

答案 0 :(得分:1)

将此人被警告的次数存储为SharedPreference。每次计数器更新,然后仅在计数时才发出< 3。

http://developer.android.com/reference/android/content/SharedPreferences.html

共享偏好设置是保留此类全局信息的最佳位置。