Yalantis / uCrop

Image Cropping Library for Android
https://yalantis.com/blog/introducing-ucrop-our-own-image-cropping-library-for-android/
11.89k stars 2.16k forks source link

E/BitmapWorkerTask: Invalid Uri scheme null #347

Closed bewithdhanu closed 7 years ago

bewithdhanu commented 7 years ago

Hello i am trying to start uCrop activity in a fragment,like this listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Uri res_url=Uri.parse(imageItems.get(position).getUrl()); UCrop.of(res_url, res_url).start(activity,Home.this); } }); but am getting crash like this, whats wrong with my code 09-19 18:00:12.778 23038-24612/com.sumasolutions.rtfms E/BitmapWorkerTask: Invalid Uri scheme null 09-19 18:00:12.787 23038-24612/com.sumasolutions.rtfms E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.sumasolutions.rtfms, PID: 23038 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.IllegalArgumentException: Invalid Uri schemenull at com.yalantis.ucrop.task.BitmapLoadTask.processInputUri(BitmapLoadTask.java:187) at com.yalantis.ucrop.task.BitmapLoadTask.doInBackground(BitmapLoadTask.java:93) at com.yalantis.ucrop.task.BitmapLoadTask.doInBackground(BitmapLoadTask.java:44) at android.os.AsyncTask$2.call(AsyncTask.java:297) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:818) 

bewithdhanu commented 7 years ago

I found problem its problem with url solution is Uri res_url=Uri.fromFile(new File((imageItems.get(position).getUrl())));