Bitmap OutOfMemoryError

后端 未结 2 396
时光取名叫无心
时光取名叫无心 2021-01-25 23:11

I have question about this error.

I make favicon parser from URLs. I do this like:

public class GrabIconsFromWebPage {
public static String replaceUrl(S         


        
相关标签:
2条回答
  • 2021-01-25 23:47

    It was bad idea with parsing icons by myself. Google did it before us

    http://www.google.com/s2/favicons?domain=(domain)

    0 讨论(0)
  • 2021-01-26 00:01

    I think, you would use universal image loader

    The method as given snippet

    // Load image, decode it to Bitmap and return Bitmap synchronously 
    ImageSize targetSize = new ImageSize(80, 50); 
    // result Bitmap will be fit to this size
    Bitmap bmp = imageLoader.loadImageSync(imageUri, targetSize, options);
    

    And for out of memory bound you would add a line in manifest file

    <application
            ...
            android:largeHeap="true"
            ...
            >
    </application>
    
    0 讨论(0)
提交回复
热议问题