Code example for Display

Methods: getHeightgetMetricsgetWidth

0
        setContentView(R.layout.main);
 
        WindowManager w = getWindowManager();
        Display d = w.getDefaultDisplay();
        DisplayMetrics metrics = new DisplayMetrics();
        d.getMetrics(metrics);
 
        Log.d("WIDTH: ", String.valueOf(d.getWidth()));
        Log.d("HEIGHT: ", String.valueOf(d.getHeight()));
 
        WindowManager windowmanager = (WindowManager)getSystemService(WINDOW_SERVICE);
        Display disp = windowmanager.getDefaultDisplay();
        int width = disp.getWidth();
        int height = disp.getHeight();
        Log.d("Java", "disp.w=" + width + " h=" + height);
 
        JsInterface jsInterface = new JsInterface();
 
        //get webview and enable js 
        wv = (WebView) findViewById(R.id.web_view);
Contextual code suggestions in your IDE  Get Codota for Java