2014-06-15 71 views
0

我的應用程序是一個openGL應用程序,我在Logcat中收到以下警告。它正在引起我的AdView - 每當我按下返回鍵(或音量鍵)出現警告:AdView導致'未實現webview方法onkeydown'Logcat警告

未實現的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); 

} 

回答