Android Fragment onAttach() deprecated

Activity is a context so if you can simply check the context is an Activity and cast it if necessary. Update: Some are claiming that the new Context override is never called. I have done some tests and cannot find a scenario where this is true and according to the source code, it should never be true. In … Read more

What is the difference between “px”, “dip”, “dp” and “sp”?

From the Android Developer Documentation: px> Pixels – corresponds to actual pixels on the screen. in> Inches – based on the physical size of the screen.> 1 Inch = 2.54 centimeters mm> Millimeters – based on the physical size of the screen. pt> Points – 1/72 of an inch based on the physical size of the screen. dp or dip> Density-independent Pixels – an abstract unit that … Read more

How to clear gradle cache?

Gradle cache is located at On Windows: %USERPROFILE%\.gradle\caches On Mac / UNIX: ~/.gradle/caches/ You can browse to these directory and manually delete it or run on UNIX system. Run this command will also force to download dependencies. UPDATE Clear the Android build cache of current project NOTE: Android Studio’s File > Invalidate Caches / Restart doesn’t clear the Android build cache, so … Read more