【问题标题】:AdView causing 'Unimplemented webview method onkeydown' Logcat warningAdView 导致“未实现的 webview 方法 onkeydown”Logcat 警告
【发布时间】:2014-06-15 19:47:57
【问题描述】:

我的应用是一个 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);

}

【问题讨论】:

    标签: android opengl-es webview user-input


    【解决方案1】:

    看起来这可能是框架本身的问题:Issue #68284

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 2018-03-04
      相关资源
      最近更新 更多