Skip to content

Instantly share code, notes, and snippets.

@erikcox
Created October 29, 2015 16:32
Show Gist options
  • Save erikcox/fe15cdb7ed274ca71262 to your computer and use it in GitHub Desktop.
Save erikcox/fe15cdb7ed274ca71262 to your computer and use it in GitHub Desktop.
// One
if(BuildConfig.DEBUG) {
Toast.makeText(this, "Debug mode", Toast.LENGTH_SHORT).show();
}
// Two
try {
appInfo = pacMan.getApplicationInfo(pacName, 0);
} catch (NameNotFoundException e) {
Toast.makeText(this, "Could not find package " + pacName, Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
// Three
buildTypes {
debug {
buildConfigField "boolean", "SOME_VAR", "true"
}
release {
buildConfigField "boolean", "SOME_VAR", "false"
}
}
// Four
BuildConfig.SOME_VAR;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment