bitmap size exceeds VM budget by starting activity again
<p>Hi When i start Activity <strong>first time it will work properly but when i start it again, i will get bitmap size exceeds VM budget</strong></p>

<p>my code is below </p>

<pre><code>public class TemplateList extends BaseActivity {

ImageUtil imgUtil;
private GridView gridView;
private LinearLayout layoutInflate;
private String Url;
public ArrayList&lt;ArrayList&lt;picitem&gt;&gt; data;
public ImageLoader1 imageLoader;
AlertMessages messages;

private ProgressDialog pd;
Thread thread = null;
private Handler handler = new Handler() {
    public void handleMessage(Message msg) {
        if (pd != null)
            pd.dismiss();
        if (msg.what == 11) {
            try {
                fillList();
            } catch (Exception e) {
                Toast.makeText(TemplateList.this, "An error has occured", Toast.LENGTH_LONG).show();
            }
        } else if (msg.what == 0) {

        } else if (msg.what == 1) {

        } else if (msg.what == 25) {

        } else {
            messages.showNetworkAlert();
        }
    }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.framegrid);

    btnHome = (Button) findViewById(R.id.btnHome);
    btnPostGard = (Button) findViewById(R.id.btnPostGard);
    btnDrake = (Button) findViewById(R.id.btnDrake);
    btnFacebook = (Button) findViewById(R.id.btnFacebook);

    gridView = (GridView) findViewById(R.id.gridFrame);

    btnHome.setBackgroundResource(R.drawable.home);
    btnPostGard.setBackgroundResource(R.drawable.postcardup);
    btnDrake.setBackgroundResource(R.drawable.drake);
    btnFacebook.setBackgroundResource(R.drawable.facebbook);

    imgUtil = new ImageUtil();
    messages = new AlertMessages(this);
    layoutInflate = (LinearLayout) findViewById(R.id.layoutinflate);

    imageLoader = new ImageLoader1(getApplicationContext(), Url);

    data = new ArrayList&lt;ArrayList&lt;picitem&gt;&gt;();
    fillData();
}

private void fillList() {
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    for (int i = 0; i &lt; data.size(); i++) {

        View customView = inflater.inflate(R.layout.cutomviewhorizontal, null);
        LinearLayout layoutHorizontalScroll = (LinearLayout) customView.findViewById(R.id.customhoriview);
        TextView txtCategory = (TextView) customView.findViewById(R.id.txtCategoryInflate);
        System.out.println();
        txtCategory.setText(data.get(i).get(0).getCategoryName()+" Templete");
        ArrayList&lt;picitem&gt; items = data.get(i);         
        for (int j = 0; j &lt; items.size(); j++) {
            View customView1 = inflater.inflate(R.layout.imginflate, null);
            final ImageView img = (ImageView) customView1.findViewById(R.id.imgCategoryInflate);
            img.setTag(items.get(j).getThumbImagePath().toString().trim());
            final String imagepathString=items.get(j).getImagePath().toString().trim();
            imageLoader.DisplayImage(items.get(j).getThumbImagePath().toString().trim(), this, img);

            img.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent i = new Intent(TemplateList.this, PictureEditor.class);
                    Bundle b = new Bundle();
                    b.putString("Key", "2");
                    b.putString("Index", imagepathString);
                    i.putExtras(b);
                    v.getContext().startActivity(i);
                    finish();
                }
            });

            layoutHorizontalScroll.addView(customView1);
        }

        layoutInflate.addView(customView);
        }
}

private void fillData() {
    if (Utils.isOnline(TemplateList.this)) {

        pd = ProgressDialog.show(TemplateList.this, "", "Loading...", true, false);
        new Thread(new Runnable() {

            @Override
            public void run() {
                try {
                    Parsing p = new Parsing();
                    data = p.getList();
                    handler.sendEmptyMessage(11);
                } catch (Exception e) {
                    e.printStackTrace();
                    handler.sendEmptyMessage(0);
                }
            }
        }).start();
    } else {
        messages.showNetworkAlert();
    }
}

@Override
protected void onResume() {
    super.onResume();
    startClick();
}
</code></pre>

<p>}</p>

<p>My Logcat is below</p>

<pre><code>   12-19 16:30:52.069: E/AndroidRuntime(11442): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
   12-19 16:30:52.069: E/AndroidRuntime(11442):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
   12-19 16:30:52.069: E/AndroidRuntime(11442):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
  12-19 16:30:52.069: E/AndroidRuntime(11442):  at com.redwood.ImageLoader1.decodeFile(ImageLoader1.java:145)
   12-19 16:30:52.069: E/AndroidRuntime(11442):     at com.redwood.ImageLoader1.getBitmap(ImageLoader1.java:103)
  12-19 16:30:52.069: E/AndroidRuntime(11442):  at com.redwood.ImageLoader1.access$0(ImageLoader1.java:96)
  12-19 16:30:52.069: E/AndroidRuntime(11442):  at com.redwood.ImageLoader1$PhotosLoader.run(ImageLoader1.java:200)
</code></pre>
