Drawables from InputStream changing with ViewFlipper
<p>I have a tabbed application, which has 5 tabs. The images in the application are taken from web call, so in tab1 for example, the first activity, makes a web call which returns the images. I am using this code</p>

<pre><code>    urln = new URL("http://10.84.4.2:8083/imageFolder/General/backgroundcurved.png");
    con = (HttpURLConnection) urln.openConnection();
    is = con.getInputStream();
    curvedBG = Drawable.createFromStream(is, "CurvedBG");
    is.close();
</code></pre>

<p>This retrieves the image just fine, and it does so with all the images. However, I have noticed a rather annoying problem that I can't seem to fix. The image size seems to change when I flip away from the view, then flip back.</p>

<p>At first I thought it was a problem with the images online. So to confirm that, I changed it so instead of the images coming from online, they come from offline in the drawable folder. So I did this</p>

<pre><code>    Drawable test;
InputStream testStream;

Resources res = getResources();
    test = Drawable.createFromStream(res.openRawResource(R.drawable.backgroundcurved), "test");
</code></pre>

<p>(For the time being, I made these global variables just so all the activities can call these images)</p>

<p>However same problem occurs. But the problem gets even stranger than that. In tab one, you can access a settings screen, and from there you can flip to menu 1, or menu 2. If menu one uses the test drawable, then it works fine, however if both menu 1 and menu 2 make use of this test drawable, then if I flip to menu 1, back to settings, then to menu 2, back to settings, then to menu 1, then the second time I access menu 1, the drawable has shrunk itself down to half its size, and yet images on menu 2 are fine. If I do that in reverse, i.e. access menu 2, then menu 1, then menu 2 again. Then the images in menu 2 mess up, yet the images in menu 1 are fine.</p>

<p>I am simply at a loss as to why this is occurring. Is there something with too many pages calling the same Drawable? Or is this a problem with viewflipper screwing up the images?</p>

<p>Would be very grateful if someone could point me in the right direction</p>

<p>Edit:</p>

<p>I also tried fetching the image using this method</p>

<pre><code>    public Object fetch(String address) throws MalformedURLException,
        IOException
{
    URL url = new URL(address);
    Object content = url.getContent();
    return content;
}

private Drawable ImageOperations(Context ctx, String url)
{
    try
    {
        InputStream is = (InputStream) this.fetch(url);
        Drawable d = Drawable.createFromStream(is, "src");
        return d;
    } catch (MalformedURLException e)
    {
        return null;
    } catch (IOException e)
    {
        return null;
    }
}
</code></pre>

<p>As I heard that would fix the problem with sizing, but same problem occurs.</p>
