How to make "Select Image From Gallery or Camera" in Android

I want to make "Select Image From Gallery or Camera". You can say there are a lot of library on the internet for this. I know but I have an another problem. I can make both select images from gallery and camera capture. But camera resulted in image rotated after the capture. I solved the problem with rotating. Now I want to show an imageview that image. Some devices didn't show the image in imageview(Samsung Note 3 Android version 5.0). I made a lot of searches and find advice. I applied the recommendations. But I can not solve that problem. Please help me.

Same problem happened with me. I am not able to see captured images on Samsung and MI devices mostly.

By using this library I have solved my issue.

https://github.com/coomar2841/android-multipicker-library

Use Cloth Face Coverings to Help Slow Spread, Our guide to different types of face coverings and step-by-step instructions on how to make them. Make eye contact. Meet your kissing partner's eyes and give them a little smile to show that you're ready for some action. You can also gently lean your forehead against your kissing partner's, put your hand on their face, touch their leg, or even give them a quick peck on the lips before you really start kissing.

On which version of android image is not shown in imageview

If it is Android N you give provider in Manifest

add this code to your manifest

  <application
        android:name=".MyApplication"
        android:theme="@style/MyAppTheme">
        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>

provider_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="external_files" path="."/>
</paths>

provider_paths is in resource-xml folder

How to Make a Face Mask at Home Easy, We are welcoming fabric masks from our community as we prepare for COVID-19​. Thank you so much for your interest and care. Learn how to do just about everything at eHow. Find expert advice along with How To videos and articles, including instructions on how to make, cook, grow, or do almost anything.

So that the user can choose an image of the gallery do this in your Activity :

The method that shows the gallery :

 private static final int SELECT_PHOTO = 1;

 public void showGallery() {
        Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
        photoPickerIntent.setType("image/*");       
        startActivityForResult(photoPickerIntent, SELECT_PHOTO);
    }

And this will be called when the user picks one image, the image path, if any, will be stored in imagePath

private String imagePath;

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            imagePath = "";
            if (requestCode == SELECT_PHOTO && resultCode == RESULT_OK) {
                Uri selectedImage = data.getData();
                String[] filePathColumn = {MediaStore.Images.Media.DATA};

                Cursor cursor = getContentResolver().query(selectedImage,
                        filePathColumn, null, null, null);

                if (cursor != null) {
                    cursor.moveToFirst();
                    int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                    imagePath = cursor.getString(columnIndex);
                    cursor.close();
                    //Here you can call a method that loads the image and 
                    //show it in an ImageView
                }
            }
        }

you will need a permission in your manifest :

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Make Fabric Face Mask at home, You can make two sizes: Adult or Child. 1. Put right sides of cotton fabric together o Cut 9x6 (Adult) or 7.5 x 5 (Child). 2. Starting at the center of the bottom edge,  Making soap at home is a practical and satisfying skill to learn. Whether you'd like a natural alternative to store-bought soap or you're a crafty person looking for a new creative venture, making soap is fun and not always as difficult as you might think.

It might be too late for the answer but I hope it will help others.

Instead of using external libraries it is better to create your own layout and use it.

Step 1: Create layout for options.

image_choose_bottom_sheet.xml

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/tvClickImageText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/ic_vector_camera_icon"
            android:gravity="center"
            android:padding="10dp"
            android:text="Take Photo"
            android:textSize="16sp"
            android:textStyle="bold"
            app:layout_constraintEnd_toStartOf="@+id/tvChooseGalleryText"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />


        <TextView
            android:id="@+id/tvChooseGalleryText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawableTop="@drawable/ic_vector_gallery_icon"
            android:gravity="center"
            android:padding="10dp"
            android:text="Choose Image"
            android:textSize="16sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="@+id/tvClickImageText"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/tvClickImageText"
            app:layout_constraintTop_toTopOf="@+id/tvClickImageText" />

    </android.support.constraint.ConstraintLayout>

</layout>

Step 2: Create a BottomSheetDialog where you can inflate the layout and configure it.

DialogImageChooser.java

public class DialogImageChooser extends BottomSheetDialogFragment {

static {
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}

View view;
//    DialogNationalitySelectionBinding mBinding;
Context mContext;
private bottomSheetListener mListener;
TextView tvClickImageText, tvChooseGalleryText;

public DialogImageChooser() {
}

@SuppressLint("ValidFragment")
public DialogImageChooser(@NonNull Context context, bottomSheetListener mListener) {
    this.mListener = mListener;
    mContext = context;
}

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    view = inflater.inflate(R.layout.image_choose_bottom_sheet, container, false);

    tvClickImageText = view.findViewById(R.id.tvClickImageText);
    tvChooseGalleryText = view.findViewById(R.id.tvChooseGalleryText);

    tvClickImageText.setOnClickListener(v -> {
        mListener.onCardClicked("camera");
        dismiss();
    });

    tvChooseGalleryText.setOnClickListener(v -> {
        mListener.onCardClicked("gallery");
        dismiss();
    });

    return view;
}


public interface bottomSheetListener {
    void onCardClicked(String option);
}
}

Step 3: Finally in the Activity just make a call for Dialog.

YourActivity.java

ivItemImage.setOnClickListener(v -> {
        new DialogImageChooser(YourActivity.this, selectedOption -> {
            if (selectedOption.equalsIgnoreCase("camera")) {
                TakePictureIntent(CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
            } else if (selectedOption.equalsIgnoreCase("gallery")) {
                Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(i, SELECT_IMAGE);
            }
        }).show(getSupportFragmentManager(), "add_photo_dialog");
    });

That's it. Custom "Select Image From Gallery or Camera Dialog" is integrated without use of any external libraries.

How to make a face mask: 4 easy ways to make DIY face coverings , Wearing a fabric face mask when you're out in public is one way you can help slow the spread of the new coronavirus. You can easily make  Make your mask. 1. Cut the bottom off a folded coffee filter. Keep the top part -- you'll need it for the filter in your mask.

Coronavirus: How to make your own face mask, To make filling deviled eggs so much easier, we recommend grabbing a set of piping bags ($24) to help your yolks stay neat. You can even jazz up the look of your deviled eggs by using different piping tips.

How to make a Face Mask, Making smoothies is hardly rocket science and there are plenty of recipes out there, but here are some tips for creating your own smoothie and then following are 5 smoothie recipes to get you started!

[PDF] How to make a Face Mask, Make it a malt: It’s easy to mimic those old-fashioned malted milks you get at a restaurant. Simply pick up malted milk powder from the store. Simply pick up malted milk powder from the store. (It’s usually found near the breakfast and chocolate milk mixes.)

Comments
  • Samsung Note 3, Android version 5.0
  • This does not correspond to the question, it serves to share files of your application, not to select an image