Here's the third round-up of Android tips I've been posting.
UrlQuerySanitizer - Sanitize URLs with this handy utility.
Fragment.setArguments - Since you can't use a Fragment constructor w/ parameters this is the second best thing. Arguments set before creation last throughout the entire Fragment's lifecycle (even if it's destroyed/recreated due to a configuration change).
DialogFragment.setShowsDialog() - Neat trick - DialogFragments can act like normal Fragments! That way you can have the same Fragment do double-duty. I usually create a third View generation method that both
onCreateDialog() call into when creating a dual-purpose Fragment.
FragmentManager.enableDebugLogging() - Help when you need it when figuring out Fragments.
PhoneNumberUtils.formatNumber() - Let someone else figure out this problem for you.
Region.op() - I found this useful for comparing two generic areas before rendering. If I've got two Paths, do they overlap? I can figure that out with this method.
Application.registerActivityLifecycleCallbacks - Though lacking documentation I feel this is self-evident. Just a handy tool.
versionNameSuffix - This gradle setting lets you modify the versionName field in your manifest based on different build types. For example, I would setup my debug build type to end in "-SNAPSHOT"; that way you can easily tell if you're on a debug build or release build.
CursorJoiner - If you're using a single database then a join in SQL is the natural solution, but what if you've received data from two separate ContentProviders? In that case CursorJoiner can be helpful.
Genymotion - A much faster Android emulator. I use it all day.
-nodpi - Most qualifiers (-mdpi, -hdpi, -xhdpi, etc.) automatically scale assets/dimensions if you're on a device that isn't explicitly defined. Sometimes you just want something consistent though; in that case use -nodpi.
BroadcastRecevier.setDebugUnregister() - Another handy debugging tool.
Activity.recreate() - Forces an Activity to recreate itself for whatever reason.
PackageManager.checkSignatures() - You can use this to find out if two apps (presumably your own) are installed at the same time. Without checking signatures someone could imitate your app easily by just using the same package name.