Class Dimensions



  • public class Dimensions
    extends java.lang.Object
    Definition of helper class that does dimension conversion operations.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Dimensions() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int convertDpToPixel(Context context, float dp)
      This method converts dp unit to equivalent pixels, depending on device density.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Dimensions

        public Dimensions()
    • Method Detail

      • convertDpToPixel

        public static int convertDpToPixel(Context context,
                                           float dp)
        This method converts dp unit to equivalent pixels, depending on device density.
        Parameters:
        dp - A value in dp (density independent pixels) unit. Which we need to convert into pixels
        context - Context to get resources and device specific display metrics
        Returns:
        A int value to represent pixels equivalent to dp depending on device density