I am assuming that the terminology Density-independent pixels and Device-independent pixels, have same meaning.
Density-independent pixels(dip) are a virtual pixel unit, equivalent to one physical pixel on a 160dpi (MDPI) screen.
4dip is equivalant to 320dpi (XHDPI) screen, because the number of pixels used to render same data on 320dpi screen is 4(2 pixels across and 2 pixels down).
How do I compute pixel units in dip for 240dpi (HDPI) screen?