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 final Matrix mMatrix = new Matrix(); | |
| private void updateMatrix() { | |
| float mw = this.getWidth(); | |
| float mh = this.getHeight(); | |
| float hw = this.getWidth() / 2.0f; | |
| float hh = this.getHeight() / 2.0f; | |
| float cw = (float)Resources.getSystem().getDisplayMetrics().widthPixels; //Make sure to import Resources package |
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 static void notifyMediaStoreScanner(Context mContext, Uri cacheImageUri) throws IOException { | |
| Uri newImageUri = createImageInMediaStore(mContext, cacheImageUri); | |
| ContentResolver resolver = mContext | |
| .getContentResolver(); | |
| FileInputStream input ; | |
| FileOutputStream outputStream ; | |
| try (ParcelFileDescriptor pfd = resolver | |
| .openFileDescriptor(newImageUri, "w", null)) { | |
| // Write data into the pending image. |
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 class ObtainImage { | |
| private Uri imgUri; | |
| /** Here goes your code where you handle the way the user chooses between getting from gallery or opening camera **/ | |
| /** | |
| * Opens gallery to choose image. | |
| */ | |
| private void chooseFromGallery() { |