我的应用是一个openGL应用,我在Logcat中收到以下警告。它是由我的AdView引起的 - 每当我按后退键(或音量键)时,都会出现警告:
未实现的webview方法onkeydown
我能做些什么来阻止这些警告出现吗?它们是我应该担心的吗?
注意:我已确认AdView导致此问题。我暂时删除了它,警告消失了。
这是我的onCreate()方法:
@Override
protected void onCreate(Bundle savedInstanceState) {
//Request full screen
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
//Disable auto connect to play services
getGameHelper().setMaxAutoSignInAttempts(0);
adSize = AdSize.SMART_BANNER;
//Create a displayMetrics object to get pixel width and height
metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
width = metrics.widthPixels;
height = metrics.heightPixels;
//Work out density of screen
density = metrics.density * 160;
x = Math.pow(metrics.widthPixels / density, 2);
y = Math.pow(metrics.heightPixels / density, 2);
screenInches = Math.sqrt(x + y);
if (screenInches > 8) { // > 728 X 90
adSize = AdSize.LEADERBOARD;
} else if (screenInches > 6) { // > 468 X 60
adSize = AdSize.MEDIUM_RECTANGLE;
} else { // > 320 X 50
adSize = AdSize.BANNER;
}
// Create an ad.
adView = new AdView(this);
adView.setAdSize(adSize);
adView.setAdUnitId(AD_UNIT_ID);
// Add the AdView to the view hierarchy.
RelativeLayout layout = new RelativeLayout(this);
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
// get test ads on a physical device.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(deviceID)
.build();
// Start loading the ad in the background.
adView.loadAd(adRequest);
//Create splash-screen object and pass in scaled width and height
splash = new SplashScreen(MainActivity.this, width, height);
//Create dialog that will show splash-screen
loading_dialog = new Dialog(MainActivity.this,android.R.style.Theme_Black_NoTitleBar_Fullscreen);
//Set and display splash screen view
loading_dialog.setContentView(splash);
loading_dialog.show();
//Create and set GL view (OpenGL View)
myView = new MyGLSurfaceView(MainActivity.this);
RelativeLayout.LayoutParams adParams =
new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
adParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
//Set the colour as there is a bug
adView.setBackgroundColor(Color.BLACK);
layout.addView(myView);
layout.addView(adView, adParams);
//Create a copy of the Bundle
if (savedInstanceState != null){
newBundle = new Bundle(savedInstanceState);
}
//Create splash object and pass bundle
//in onPostExecute
DisplaySplash goSplash = new DisplaySplash(newBundle);
goSplash.execute();
//Set main renderer
setContentView(layout);
}