0

我在我的应用程序中发出了警报,它在我想要它的主要活动中非常完美,但我希望它在警告该人三次后消失..不是每次我回到主要活动时它都会出现

这是我的警报代码

        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();
4

1 回答 1

1

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

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

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

于 2012-07-31T19:08:41.920 回答