How to convert URL to a URI?
<p>I am trying to cache these images using this code...</p>

<p>But i keep getting a syntax error here?</p>

<pre><code> Uri imageUri = new Uri(aURL);
</code></pre>

<p>Here is the code im using.</p>

<pre><code>                                URL aURL = new URL(myRemoteImages[position]);



                                Uri imageUri = new Uri(aURL);
                                if (new File(new File(myContext.getCacheDir(), "thumbnails"), "" + imageUri.hashCode()).exists())
                                {
                                    String cachFile = ""+imageUri.hashCode();
                                    FileInputStream fis;

                                    try {
                                        fis = new FileInputStream(cachFile);
                                        Bitmap bm = BitmapFactory.decodeStream(fis); 
                                         i.setImageBitmap(bm);
                                            i.setScaleType(ImageView.ScaleType.FIT_CENTER);
                                            /* Set the Width/Height of the ImageView. */
                                            if(Build.VERSION.SDK_INT &gt;= 11){
                                                i.setLayoutParams(new Gallery.LayoutParams(450, 300));
                                            }
                                            else{
                                                i.setLayoutParams(new Gallery.LayoutParams(125, 125));
                                            }


                                    } catch (FileNotFoundException e) {

                                           Log.e("DEBUGTAG", "Remtoe Image Exception", e);





                                            /* Image should be scaled as width/height are set. */
                                            i.setScaleType(ImageView.ScaleType.FIT_CENTER);
                                            /* Set the Width/Height of the ImageView. */
                                            if(Build.VERSION.SDK_INT &gt;= 11){
                                                i.setLayoutParams(new Gallery.LayoutParams(450, 300));

                                            return i;
                                            }
                                                i.setLayoutParams(new Gallery.LayoutParams(125, 125));
                                                return i;
                                            }
</code></pre>
