Hi,

I've a problem (too malloc) when i read pics from sdcard in my gridview.

public override View GetView (int position, View convertView, ViewGroup parent)
{
            ImageView imageView;

            if (convertView == null)
            {
                imageView = null;
                imageView = new ImageView(context);
                imageView.SetAdjustViewBounds(true);
            }
            else
                imageView = (ImageView)convertView;

            //Default pic
imageView.SetImageResource(Resource.Drawable.DefaultImageGridView);

            imageView.Id = int.Parse(Liste[position].IdFichier);
            imageView.Tag = "default";

string nameofpic = Liste[position].FolderFichier + Config.TypeMiniatures + Liste[position].Fichier;
            nameofpic = nameofpic.Replace('/', '_');
            if (File.Exists(Config.CheminCache + nameofpic))
           {
                    //i print the good pic

imageView.SetImageDrawable(Drawable.CreateFromPath(Config.CheminCache + nameofpic));

                    //same problem with it
//imageView.SetImageBitmap(BitmapFactory.DecodeFile(Config.CheminCache + nameofpic));
           }

           return imageView;
        }


My gridview print 100 pics, and the pics are in the sdcard. If i scroll up, down, lot of time, i've this result:


05-11 12:01:25.117 D/dalvikvm( 3475): GC_FOR_MALLOC freed 167 objects / 481688 bytes in 64ms 05-11 12:01:25.187 D/dalvikvm( 3475): GC_FOR_MALLOC freed 92 objects / 479856 bytes in 43ms 05-11 12:01:25.539 D/dalvikvm( 3475): GC_FOR_MALLOC freed 91 objects / 1020584 bytes in 27ms 05-11 12:01:25.680 D/dalvikvm( 3475): GC_FOR_MALLOC freed 129 objects / 1432144 bytes in 28ms
[...]
05-11 12:01:48.469 D/dalvikvm( 3475): GC_FOR_MALLOC freed 162 objects / 1909360 bytes in 29ms 05-11 12:01:48.617 E/dalvikvm-heap( 3475): 232112-byte external allocation too large for this process. 05-11 12:01:48.617 E/GraphicsJNI( 3475): VM won't let us allocate 232112 bytes 05-11 12:01:48.617 E/dalvikvm-heap( 3475): 232112-byte external allocation too large for this process. 05-11 12:01:48.617 E/GraphicsJNI( 3475): VM won't let us allocate 232112 bytes 05-11 12:01:48.680 E/dalvikvm-heap( 3475): 84480-byte external allocation too large for this process. 05-11 12:01:48.680 E/GraphicsJNI( 3475): VM won't let us allocate 84480 bytes
05-11 12:01:48.680 D/skia    ( 3475): --- decoder->decode returned false
05-11 12:01:48.719 I/MonoDroid( 3475): UNHANDLED EXCEPTION: Java.Lang.OutOfMemoryError: Exception of type 'Java.Lang.OutOfMemoryError' was thrown.


If i just print the Resource.Drawable.DefaultImageGridView, and scroll lot of, i've no problem.

I'm on android 2.1, with a harddevice (no avd)


Have an idea?

regards
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to