I am trying to create an application which will display an image which
is larger than the screen of the device where the user can scroll
around to see different parts of the picture. This all works fine
until I open or close the keyboard on my G1 whereupon the application
crashes. Funnily enough it does not crash if only the orientation is
changed without opening or closing the keyboard. I reduced the
application to the bare minimum to try to see if I could work around
it in some way but it seems that as soon as I create an ImageView with
a large picture the memory is never released, even if I dereference
the ImageView object. Clearly there is something essential that I
don't understand here, could someone help, please?

A stripped down version of my app is below. I have created a standard
android application in Eclipse and modified the java file as below.
The drawable largeimage is a png file of 1.3mb.

package com.mattsm8.android.imagetest;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;

public class ImageTest extends Activity {
    ImageView iv = null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        iv = new ImageView(this);
        setContentView(iv);
        iv.setImageDrawable(iv.getResources().getDrawable
(R.drawable.largeimage));
        setContentView(R.layout.main);
        iv = null;
    }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to