Code example for WindowManager

Methods: getDefaultDisplay

0
    } 
 
    private DisplayMetrics getDisplayMetrics() {
        DisplayMetrics metrics = new DisplayMetrics();
        WindowManager wm = (WindowManager) context.getSystemService(WINDOW_SERVICE);
        wm.getDefaultDisplay().getMetrics(metrics);
        return metrics;
    } 
 
    public static class TextAppearance { 
        public final int colour;
        public final float size;
 
        public TextAppearance(int colour, float size) {
            this.colour = colour;
            this.size = size;
        } 
 
        public void setOn(RemoteViews remoteViews, int viewId) {
            remoteViews.setTextColor(viewId, colour);
            remoteViews.setFloat(viewId, "setTextSize", size);