Reading application's versionCode and versionName

When versioning your application, you use the AndroidManifest.xml to specify the versionCode and versionName. You can read your application’s versionCode and versionName from you activity using the following code: PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); int versionNumber = packageInfo.versionCode; String versionName = packageInfo.versionName; To know more about versioning your app read de documentation.

January 5, 2012 · 1 min · Elyézer Rezende

Updating a preference value without reloading PreferenceActivity

This code snippet shows how to get a reference to a preference in PreferenceActivity. With this reference, you could update the UI without reloading the PreferenceActivity. Source: Update preference value without reloading PreferenceActivity

December 22, 2011 · 1 min · Elyézer Rezende