If a drawable resource is provided for ldpi, mdpi, hdpi, xhdpi, this drawable does not need to provided for nodpi?

Do I understand this correctly:

All android devices fall in one of these 4 density buckets: ldpi, mdpi, hdpi, xhdpi.

  • android emulator access server in local network
  • Is there any free C++ and/or C# compiler that runs on an Android-enabled Tablet PC?
  • Android - programmatically creating view progressBar
  • Canvas: trying to use a recycled bitmap android.graphics.Bitmap in android
  • Different named Markers on Google Android Map
  • How to use Toast when I cant use “this” as context
  • So, if a drawable resource is provided for each of these for densities (a drawable or with the same name exists in each of these folders), then it is not necessary to provide a drawable with the same name in /res/drawable or /res/drawable-nodpi.

    Is my understanfing correct?

    So, the only reason, why it makes sense to provide that same resource in /res/drawable would be, to make the app more future-proof, in case a new density bucket is defined for Android OS?

    Related posts:

    Create folder in Android
    Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V Exception details are logged...
    Using parents for drawable resources
    android how to use string resource in a java class
    Android: ANT build fails with google-play-services-lib: “resolve to a path with no project...
    Android changing the background color for preference fragment
  • Intent.ACTION_VIEW for Android Image
  • How to hide keyboard on enter key
  • Google App Engine with Android - testing endpoints on real device
  • Android games development SDK?
  • set icon at the end of toolbar
  • appwidget freezes and refuses to update anymore: ignores updateAppWidget
  • 3 Solutions collect form web for “If a drawable resource is provided for ldpi, mdpi, hdpi, xhdpi, this drawable does not need to provided for nodpi?”

    Is my understanfing correct?

    Through this paragraph, you are more or less correct. You go a bit “off the rails” with your next paragraph:

    So, the only reason, why it makes sense to provide that same resource in /res/drawable would be, to make the app more future-proof, in case a new density bucket is defined for Android OS?

    Not really.

    You put resources in res/drawable/ that are intrinsically scalable (e.g., a ShapeDrawable). You put resources in res/drawable-nodpi/ that, for some reason, you do not want to be scaled to match the device density.

    If Android invents a new density bucket (e.g., -uhdpi for an ultra-high density of 400dpi), Android will probably do what it does today if you skip a density bucket: scale one of your other editions. For example, if you have -xhdpi and do not have -hdpi, Android will down-sample the -xhdpi image for use on an -hdpi device.

    This is correct, as long as you have drawables in all 4 density buckets you are covered. A common practice is to make a custom drawable in /res/drawable which refers your density spanning drawables.

    For example, you may want a button with different states for pressed and unpressed. First, you would include a drawable of each density for a pressed and unpressed button. Then you could create the following button_black_selector.xml in /res/drawables:

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    
        <item android:state_pressed="false"
            android:drawable="@drawable/button_black"/>
    
        <item android:state_pressed="true"
            android:drawable="@drawable/button_black_selected" />
    
    </selector>
    

    If your resource is added for all the four densities, then you’re correct that you don’t have to add the drawable to the folder /res/drawable. However, you’ve guessed correctly that it is best to have something in the default folder in the case if a new qualifier appears. Therefore, I recommend to place mdpi resources not to the /res/drawable-mdpi folder, but to the default folder instead (/res/drawable/). It is a good practice for every kind of resource.

    As for the /res/drawable-nodpi folder, it is a special folder, because it is supposed to contain resources which do not scale automatically unlike all other qualifiers. Therefore you usually either use the /res/drawable-nodpi folder alone, or do not use it at all.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.