Sunday, February 9, 2014

android load big picture issues


            
Show the big picture at the request without sacrificing picture quality, the width and height requirements are original width and height, I have temporarily increased the cache, although no OOM error, but if the picture is too large will not be displayed. As follows:

1.listview only one child inside imageview

2 sd card is loaded inside the picture

3 Use a soft references SoftReference softReference

4 pictures if less than 1mb no problem, if not more than 1mb throw an exception, but the picture does not show up, the code is as follows:.
The local picture is loaded into the drawable code:
 
File f = new File (locationUrl);
if (f.exists () && f.length ()> 0) {
Presence
/ / fileBitmapFactory.Options bfOptions = new BitmapFactory.Options ();
bfOptions.inDither = false;
bfOptions.inPurgeable = true;
bfOptions.inInputShareable = true;
bfOptions.inTempStorage = new byte [32 * 1024];
FileInputStream fs = null;
try {
fs = new FileInputStream (f);
} Catch (FileNotFoundException e) {
e.printStackTrace ();
}
Bitmap bmp = null;
if (fs! = null) {
try {
bmp = BitmapFactory.decodeFileDescriptor (fs.getFD (), null, bfOptions);
BitmapDrawable drawable = new BitmapDrawable (bmp);
imageCache.put (imageUrl, new SoftReference (drawable));
return drawable;
} Catch (IOException e) {
e.printStackTrace ();
}
}
}

Drawable will return loaded into imageview
 
Drawable
Drawable cacheImage = obtained by calling the above codeif (cacheImage! = null) {
viewHolder.iv_img.setImageDrawable (cacheImage);
}

Reply:
No solution
Reply:
Their top one, solve, thank you, the answer immediately Results posted
Reply:
And do not use soft references with bitmap drawable
Reply:
reference to the third floor wenwei19861106 reply:
still do not use soft references drawable with bitmap

1 I use soft references
I have problems with drawable now 2 is a placeholder for the picture came out, that is occupying the place does not display the contents of the picture, is a transparent thing. Bitmap can be avoided with this situation? Why? Thank you
Reply:
references, 4th Floor fire_fire_fire reply:
Quote: references to the third floor wenwei19861106 reply:

And do not use soft references drawable with bitmap

1 I use soft references
I have problems with drawable now 2 is a placeholder for the picture came out, that is occupying the place does not display the contents of the picture, is a transparent thing. Bitmap can be avoided with this situation? Why? Thank you
bitmap can save because ultimately passed into drawable form part of the memory bitmap display
Reply:
reference to the third floor wenwei19861106 reply:
still do not use soft references drawable with bitmap


I tried, not, whether it is drawable or bitmap images are not displayed.
Reply:
reference to the 6th floor fire_fire_fire reply:
Quote: references to the third floor wenwei19861106 reply:

And do not use soft references drawable with bitmap


I tried, not, whether it is drawable or bitmap images are not displayed.
Carolina on only Image compression method can be used if the clarity of the picture, then do not ask
Reply:
reference to the 7th floor wenwei19861106 reply:
Quote: references to the 6th floor fire_fire_fire reply:

Quote: references to the third floor wenwei19861106 reply:

And do not use soft references drawable with bitmap


I tried, not, whether it is drawable or bitmap images are not displayed.
Carolina on only Image compression method can be used if the clarity of the picture do not ask if

The picture is demanding, no way. I can only upload in the background when to limit the size of the picture
Reply:
lz get out? ? I have encountered similar problems

No comments:

Post a Comment