Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting java.lang.OutOfMemoryError #5

Open
4tis opened this issue Mar 19, 2014 · 1 comment
Open

Getting java.lang.OutOfMemoryError #5

4tis opened this issue Mar 19, 2014 · 1 comment

Comments

@4tis
Copy link

4tis commented Mar 19, 2014

Hi there,

Two things I would like to understand -

  1. After following the instructions (clean and building project),

I have tried this simple code -

    im = (ImageView) findViewById(R.id.imageView1);
    Bitmap bm = BitmapFactory.decodeResource(getResources(),R.drawable.pic);

      Bitmap newBitmap = BitmapFilter.changeStyle(bm, BitmapFilter.BLUR_STYLE);
      im.setImageBitmap(newBitmap);

The thing is that the app is crushing and i get the java.lang.OutOfMemoryError.

  1. Is it possible to save the bitmap with the filter (that are being shown at the ImageView)? and if so how can it be done?
@ragnraok
Copy link
Owner

The first problem, it the algorithm issue, I will try to fixed this by optimize the algorithm
and the second problem, the filter function output is a Bitmap object, so I think you can save it in your phone you android API, for example, you can write a function like this:

public void saveMyBitmap(String fileName,Bitmap mBitmap){
    File f = new File(Environment.getExternalStorageDirectory(), fileName);
    FileOutputStream fOut = null;
    try {
        f.createNewFile();
        fOut = new FileOutputStream(f);
    } catch (IOException e) {
        e.printStackTrace();
    }
    mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
    try {
        fOut.flush();
        fOut.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants