Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fabLayoutGallery.setOnClickListener(v -> {
- Intent fileintent = new Intent(Intent.ACTION_GET_CONTENT);
- fileintent.setType("image/*");
- try {
- startActivityForResult(Intent.createChooser(fileintent, "Select Picture"), REAUEST_CODE_IMAGE_GALLERY);
- } catch (ActivityNotFoundException e) {
- Log.e("tag", "No activity can handle picking a file. Showing alternatives.");
- }
- });
- @Override
- protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == REAUEST_CODE_IMAGE_GALLERY && resultCode == RESULT_OK) {
- Uri imageUri = data.getData();
- String path = data.getDataString();
- Bitmap bmp = null;
- try {
- bmp = getThumbnail(this, imageUri);
- formDataRequest(path);
- } catch (IOException e) {
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement