Android - How To Take A Photo And Crop Using Imagecropper.forms?
ill take any help here.. I am using xamarin and would like to: Click on button Open Camera Take photo Crop Photo Create Folder in Gallery Save Cropped photo in new folder in Galle
Solution 1:
The plugin you used is too old. You could use ImageCropper.Forms.Fix.v2
instead.
Add the code below in your MainActivity:
Stormlion.ImageCropper.Droid.Platform.Init();
protectedoverridevoidOnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
Stormlion.ImageCropper.Droid.Platform.OnActivityResult(requestCode, resultCode, data);
}
Add the code in tag of AndroidManifest.xaml:
<activityandroid:name="com.theartofdev.edmodo.cropper.CropImageActivity"android:theme="@style/Base.Theme.AppCompat" />
Code behind:
newImageCropper()
{
// PageTitle = "Test Title",// AspectRatioX = 1,// AspectRatioY = 1,Success = (imageFile) =>
{
Device.BeginInvokeOnMainThread(() =>
{
image.Source = ImageSource.FromFile(imageFile);
});
}
}.Show(this);
When you click the button, it would pop up a window. If you want to take photo, choose the Take Photo
. Please note, you need to add the CAMERA
permission.
<uses-permissionandroid:name="android.permission.CAMERA" />
Or you could select the image from the device to crop.
OutPut:
Post a Comment for "Android - How To Take A Photo And Crop Using Imagecropper.forms?"