Posts

Showing posts from April, 2018

Shortcut for android for every version, android shortcut for oreo, android shortcut for nougat.

if (Build.VERSION. SDK_INT >= 26 ){ try { ShortcutManager shortcutManager= context .getSystemService(ShortcutManager. class ); Intent shortcutIntent= new Intent(getApplicationContext(),ClassCalledOnShortcutClicked. class ); shortcutIntent.setAction(Intent. ACTION_MAIN ); ShortcutInfo postInfo= new ShortcutInfo.Builder( context , "ShortcutName" ) .setShortLabel( "ShortcutShortLabel" ) .setLongLabel( "ShortcutLongLabel" ) .setDisabledMessage( "DisableMessage" ) .setIcon(Icon. createWithResource ( context ,R.mipmap. ic_launcher )) .setIntent(shortcutIntent) .build(); shortcutManager.setDynamicShortcuts(Arrays. asList (postInfo)); //to pin shortcut to mobile in oreo if (shortcut...

Rotating image in 30, 45,60,75 ,90,120, 180, 270 ,360 degree depend upon angle provided in android. Image rotation in android

Rotating image in 30, 45,60,75 ,90,120, 180, 270 ,360 degree depend upon angle provided in android. Image rotation in android //pass bitmap of image and angle to rotate public static Bitmap RotateBitmap(Bitmap source, float angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); Bitmap rotatedImg = Bitmap. createBitmap (source, 0 , 0 , source.getWidth(), source.getHeight(), matrix, true ); source.recycle(); return rotatedImg; }