Why not storing the files on sdcard and passing only the names?

On Dec 19, 7:01 pm, Ankur Avlani <ankuravl...@gmail.com> wrote:
> Hi All ,
>
> I am developing an application in WebView.  We serve android sd card images
> (average 3 MB per image) using ContentProvider in web view.  Please see the
> sample code below:
>
> public class LocalImageContentProvider extends ContentProvider {
>     @Override
>     public ParcelFileDescriptor openFile(Uri uri, String mode) throws
> FileNotFoundException {
>         try {
>             String path = uri.getPath();
>             File file = new File(path);
>
>             ParcelFileDescriptor parcel = ParcelFileDescriptor.open(file,
> ParcelFileDescriptor.MODE_READ_ONLY);
>             return parcel;
>         } catch (IOException e) {
>             // TODO Auto-generated catch block
>
>             e.printStackTrace();
>         }
>         return null;
>     }
>
> }
>
> This works fine for the first 50-60 images.  But when i start browsing more
> images, I see that the memory increaseing and Android starts closing
> background process to free up memory and finally the core process shutsdown
> and my app crashes.
>
> Question is, is there anything that I need to add in the above code to make
> is more robust and not occupy unnecessary memory.
>
> Thanks and regards
> Ankur

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to