如何在应用程序加载上显示Android Native Alertdialog而不显示任何其他内容

时间:2017-09-20 15:29:05

标签: android alertdialog android-alertdialog

我正在尝试在应用加载后立即显示原生Alertdialog,但广告在此之前显示。我想确保这个Alertdialog显示为应用程序加载时的第一件事,当Alertdialog被解除时,广告和其他所有内容都应该加载。

有关如何在Android应用程序中执行此操作的任何想法?

以下是我在代码中所拥有的内容:



 public void checkForCookiePolicy()
		{
			final SharedPreferences settings =
			        getSharedPreferences("localPreferences", MODE_PRIVATE);
			    if (settings.getBoolean("isFirstRun", true)) {
			    
			    	AlertDialog.Builder builder1 = new AlertDialog.Builder(getContext());
					builder1.setTitle("Cookie Policy");
					builder1.setMessage("We use device identifiers to personalise content and ads, to provide social media features and to analyse our traffic. We also share such identifiers and other information from your device with our social media, advertising and analytics partners.");
					builder1.setCancelable(true);

					builder1.setPositiveButton("See Details",
							new DialogInterface.OnClickListener() {
								public void onClick(DialogInterface dialog, int id) {
									
									Intent intent = new Intent(AppActivity.this, CookiePolicy.class);
									startActivity(intent);
									settings.edit().putBoolean("isFirstRun", false).commit();
								
								}
							});
					builder1.setNegativeButton("Dismiss", new DialogInterface.OnClickListener() {
						public void onClick(DialogInterface dialog, int id) {
							settings.edit().putBoolean("isFirstRun", false).commit();
							dialog.cancel();
							
						}
					});

					AlertDialog alert11 = builder1.create();
					alert11.show();
			    }
			  
		}




这是广告代码。它高于警报代码:



		revmob = RevMob.start(this);
		revmob.createFullscreen(this, null);




0 个答案:

没有答案