This Function return the Android Device Display Width. - Android User Interface

Android examples for User Interface:Screen Size

Description

This Function return the Android Device Display Width.

Demo Code


//package com.java2s;
import android.app.Activity;
import android.content.Context;

public class Main {
    /**/*from w w  w  .j av a 2s  .c o m*/
     * This Function return the Android Device Display Width.
     * 
     * See below for @params.
     */

    public static int getMyDispalyWidth(Context ctx) {

        int Width = ((Activity) ctx).getWindowManager().getDefaultDisplay()
                .getWidth();
        return Width;
    }
}

Related Tutorials