in Education by
I have use the pesdk library to edit an image. public static int GALLERY_RESULT = 2; private void selectImgtoEdit() { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(path)); startActivityForResult(intent, GALLERY_RESULT); } protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); Uri selectedImage = intent.getData(); openEditor(selectedImage); } public void openEditor(Uri inputImage) { SettingsList settingsList = createPesdkSettingsList(); // Set input image settingsList.getSettingsModel(LoadSettings.class).setSource(inputImage); settingsList.getSettingsModel(PhotoEditorSaveSettings.class).setOutputToGallery(Environment.DIRECTORY_DCIM); new PhotoEditorBuilder(this).setSettingsList(settingsList).startActivityForResult(this, PESDK_RESULT); } I want to use that library with the absolute path of an image. How can I setting it ? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You should convert absolute path to content uri. For example Below Android P public static Uri getImageContentUri(Context context, File imageFile) { String filePath = imageFile.getAbsolutePath(); Cursor cursor = context.getContentResolver().query( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[] { MediaStore.Images.Media._ID }, MediaStore.Images.Media.DATA + "=? ", new String[] { filePath }, null); if (cursor != null && cursor.moveToFirst()) { int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID)); cursor.close(); return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + id); } else { if (imageFile.exists()) { ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.DATA, filePath); return context.getContentResolver().insert( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); } else { return null; } } } Above Android Q public static Uri getImageContentUri(Context context, File imageFile) { String filePath = imageFile.getAbsolutePath(); Cursor cursor = context.getContentResolver().query( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[]{MediaStore.Images.Media._ID}, MediaStore.Images.Media.DATA + "=? ", new String[]{filePath}, null); if (cursor != null && cursor.moveToFirst()) { int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID)); cursor.close(); return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + id); } else { if (imageFile.exists()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { ContentResolver resolver = context.getContentResolver(); Uri picCollection = MediaStore.Images.Media .getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); ContentValues picDetail = new ContentValues(); picDetail.put(MediaStore.Images.Media.DISPLAY_NAME, imageFile.getName()); picDetail.put(MediaStore.Images.Media.MIME_TYPE, "image/jpg"); picDetail.put(MediaStore.Images.Media.RELATIVE_PATH,"DCIM/" + UUID.randomUUID().toString()); picDetail.put(MediaStore.Images.Media.IS_PENDING,1); Uri finaluri = resolver.insert(picCollection, picDetail); picDetail.clear(); picDetail.put(MediaStore.Images.Media.IS_PENDING, 0); resolver.update(picCollection, picDetail, null, null); return finaluri; }else { ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.DATA, filePath); return context.getContentResolver().insert( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); } } else { return null; } } }

Related questions

0 votes
    I have use the pesdk library to edit an image. public static int GALLERY_RESULT = 2; private void ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: Saving path in String (4 answers) Closed 5 years ago. I'm ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 30, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: Saving path in String (4 answers) Closed 5 years ago. I'm ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 23, 2022 in Education by JackTerrance
0 votes
    Currently I'm using Cloudinary.com to save my users images. I know how to do some of the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    I am trying to use MVC model to create "update news" page. News has an image and i am using ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    I want to load an image from my computer into 2D Graphics so that I can edit it afterwards and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    The rate of the chemical reaction doubles for an increase of 10K in absolute temperature from 300K . Calculate Ea . Select the correct answer from above options...
asked Jan 4, 2022 in Education by JackTerrance
0 votes
    An example of absolute cell reference is a) =A6:b6 b) = a 6:b6 c) = a 6:b$6 d) = a 6: b 6 Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    A representation of an attribute that cannot be measured directly, and are subjective and dependent on the context of ... was derived. (1)Relative Metrics (2)Absolute Metrics...
asked May 15, 2021 in Technology by JackTerrance
0 votes
    I'm using the cacheCounter in CakePHP, which increments a counter for related fields. Example, I have a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm using the cacheCounter in CakePHP, which increments a counter for related fields. Example, I have a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I think this is a common requirement eg. "How can I create an ACL like only author can edit his ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    I have an application in which I am storing time values in an array. The time is getting stored ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    How can I apply my div position x value to a variable? And how to iterate it in a for loop? ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
...