Android App Development for Beginners – 16 – Converting DIP to Pixels

Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –






31 responses to “Android App Development for Beginners – 16 – Converting DIP to Pixels”

  1. Shahab Ali Avatar

    I have a question. When developing a professional android application we should always use DIPz and convert them to pixels?

  2. Khodkumbhe Awani Ramdas Avatar

    Do we have to do this conversion even if we have a 25 API version?

  3. Khodkumbhe Awani Ramdas Avatar

    Hey,Bucky you can enter into android studio presentation mode to show the stuff clearly 🙂

  4. Khodkumbhe Awani Ramdas Avatar

    Do we need the conversion of Device Pixels to pixels if we are using API >15?

  5. Shashank Kumar Avatar

    Hey! if you are serious about learning Android app development then this app for you it released today on play store after Windows store:– It also Contains 40 plus app examples with source code that really helps

    Play store link-

  6. NnikoG Avatar

    I do have one question, how can I change the color of the EdidTexts line?

  7. Matt LeClerc Avatar

    These errors in the code are driving my ocd insane.

  8. Rakly3 Avatar

    He wrote this in Android Studio 1.1
    Right now I'm using 2.2.3
    There must be a way better function by now, no?
    If you know, pls reply 🙂

  9. Marv3Lthe1 Avatar

    Why android does not have built in DIP to Pixel conversion functions :-/

  10. latibro21 Avatar

    Should have made examples of using PX and DP before teaching this. Very confusing.

  11. Amit Tiwari Avatar

    Simply use below code.


    if you are using min API>15 and Android Studio 2.2
    no need of conversion.

  12. Edimax TV Avatar

    So, anyone got the actual difference between pixels, and device pixels??

  13. haroon rasheed Avatar

    how get rid of the error "unfortunately the program has stopped" during the runtime

  14. John Manlavi Avatar

    To all you who wants to get a clear view of his source code, replace the "watch?v=" above with an "embed/". It'll be a full screen version BUT only within the browser area. Really helpful if you're going along with him like me haha

  15. Mohit Bondwal Avatar

    if you don't have any issues with the width covering the full area horizontally. I would prefer this. RelativeLayout.LayoutParams.MATCH_PARENT,
    this will automatically cover all the available width in any android device. So we just won't need any conversions.

  16. omegamagna Avatar

    Okay, I know Java.
    Still though, I have no idea how to keep up with all of these android commands, what they are, or how to use the syntax for them.

    How do all of you keep up with this? Is there like a sheet list that shows all the commands you can do in android? This is way too much to memorize.

  17. Anirudha Gogawale Avatar

    instead of this drag and drop widgets is easy and there also we can change the dim and other parameters …this code is lit confusing btw u explained preety well

  18. TheForsa1994 Avatar


    float applyDimension (int unit,
    float value,
    DisplayMetrics metrics)

    Converts an unpacked complex data value holding a dimension to its final floating point value. The two parameters unit and value are as in TYPE_DIMENSION.

    unit int: The unit to convert from.
    value float: The value to apply the unit to.
    metrics DisplayMetrics: Current display metrics to use in the conversion — supplies display density and scaling information.

  19. Sankar Chakravarty Avatar

    cannot read the source codes, where is the source code of this particular video in forum ??

  20. Karan Jatav Avatar

    so if layoutparam takes only pixel values and u made arrangements for that so does the setmargin method.. y dint u converted pixels for setmargins parameter as well??

  21. Heydar Rzayev Avatar

    I wish C# was the native language of Android! Anyways, +Bucky Roberts, thank you!

  22. John Smith Avatar

    lmfao everyone in these comments in a pompous douche its hilarious

  23. Hannah Khelfa Avatar

    what episode does this actually teach you how to program in androd studio

  24. HKYT649 Avatar

    Java programming is too complicated. Why don't they make a "wrapper" to make it simpler to code? God damn it!

  25. Nitin Shenoy Avatar

    i am a follower of bucky's videos and have seen many…though in these tutorials am i the only one who can understand just like only 20-30% of stuff….the rest are all bouncers

  26. Mohamed Alaa Avatar

    WELL , That's so confusing :@

  27. Shivashriganesh Mahato Avatar

    Where do you explain the ImageView widget?

  28. dhruva pandey Avatar

    why not do all that in xml ? its too easy there then compared to JAVA.

  29. Ich Ich Avatar

    Is It possible to open two activitys at the same time but next to each other?

Leave a Reply

Your email address will not be published. Required fields are marked *