is Dual Pane Display - Android User Interface

Android examples for User Interface:Display

Description

is Dual Pane Display

Demo Code


//package com.java2s;
import android.content.Context;
import android.util.DisplayMetrics;

public class Main {
    /**//  w  ww  .  j  av  a2 s .com
     * @param context Context for accessing display metrics.
     * @return {@code true} if the main view contains two panes for master-detail mode.
     */
    public static boolean isDualPane(Context context) {
        DisplayMetrics metrics = context.getResources().getDisplayMetrics();
        // master detail mode activated for screen width > 720dp
        return metrics.widthPixels / metrics.density > 720;
    }
}

Related Tutorials