This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private enum GravityExpandableText { | |
LEFT(Gravity.LEFT), RIGHT(Gravity.RIGHT), CENTER(Gravity.CENTER); | |
private final int mValue; | |
GravityExpandableText(int value) { | |
mValue = value; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VBoxManage controlvm Google\ Nexus\ 5\ -\ 4.4.2\ -\ API\ 19\ -\ 1080x1920 poweroff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int getDisplayContentHeight() { | |
final WindowManager windowManager = getWindowManager(); | |
final Point size = new Point(); | |
int screenHeight = 0, actionBarHeight = 0; | |
if (getActionBar() != null) { | |
actionBarHeight = getActionBar().getHeight(); | |
} | |
int contentTop = ((ViewGroup) findViewById(android.R.id.content)).getTop(); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | |
windowManager.getDefaultDisplay().getSize(size); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Point getScreenSize() { | |
Point size = new Point(); | |
WindowManager w = getWindowManager(); | |
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | |
w.getDefaultDisplay().getSize(size); | |
}else{ | |
Display d = w.getDefaultDisplay(); | |
size.x = d.getWidth(); | |
size.y = d.getHeight(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildTypes { | |
release { | |
runProguard false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pass in values as arguements if required... | |
private AlertDialog.Builder getSimpleDialogBuilder() { | |
return new AlertDialog.Builder(this) | |
.setMessage(getString("Some message here")) | |
.setCancelable(true) | |
.setPositiveButton("Yes", | |
new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int id) { | |
// do something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean unknownSources = Settings.Secure.getInt(getContentResolver(), | |
Build.VERSION.SDK_INT < 17 ? | |
Settings.Secure.INSTALL_NON_MARKET_APPS : | |
Settings.Global.INSTALL_NON_MARKET_APPS, 0) == 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only works if app has a launcher activity | |
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.example.yourapp"); | |
startActivity(launchIntent); | |
// works if we know the name of the main activity, even if not a launcher | |
Intent intent = new Intent(Intent.ACTION_MAIN); | |
intent.setClassName("com.example.yourapp", "com.example.yourapp.MainActivity"); | |
startActivity(intent); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aapt dump badging your.apk |