Try to prevent OutOfMemoryException while loading contacts' picture
This commit is contained in:
parent
861d14827b
commit
f06c2bfc28
1 changed files with 6 additions and 1 deletions
|
@ -23,6 +23,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.preference.CheckBoxPreference;
|
||||
|
@ -274,7 +275,11 @@ public class ApiFivePlus {
|
|||
contact = new Contact(id, name);
|
||||
}
|
||||
else {
|
||||
contact = new Contact(id, name, photo, BitmapFactory.decodeStream(input));
|
||||
Bitmap bm = null;
|
||||
try {
|
||||
bm = BitmapFactory.decodeStream(input);
|
||||
} catch (OutOfMemoryError oome) {}
|
||||
contact = new Contact(id, name, photo, bm);
|
||||
}
|
||||
|
||||
return contact;
|
||||
|
|
Loading…
Reference in a new issue