java.io.FileNotFoundException: content://com.android.contacts/contacts/24093/photo for old photos only -
I am receiving my contact image urets from my phone's contact list.
However, when I convert the image to a bitmap I get an error:
java.io.FileNotFoundException: content: //com.android.contacts/contacts/ 24093 / photo There is something with the old pictures on my device, as if I take a new photo, it is shown okay.
Therefore, old photographs are probably too big or not good, but exception means java.io.FileNotFoundException How do I issue an access rights to it Can i do
last bitmap bitmap; Try {bitmap = MediaStore.Images.Media.getBitmap (ab.getContentResolver (), tryUri); ab.runOnUiThread (New Runnabel () {@Override public void run ()} / / Ensure that the tag is still set at the beginning of this function if (toSet.getTag () == urlStr) {toSet.setImageBitmap (bitmap) );}}}); } Hold (FileNotFoundException e) {string A = "1"; } Hold (IOException e) {string A = "1"; } Hold (exception e) {string A = "1"; } Two possibilities: 1) Yuri, who you are using, is no longer good.
Try it using ContactsContract instead of GetBitmap, if the file does not exist instead of a file Notfault error, then you will end up with a null:
Show private zeros Pin of (string photo yuri) {bitmap [] array = new bitmap [2]; Cursor cursor = getContentResolver (). Query (Uri.parse (photoUri), new string [] (ContactsContract.Contacts.Photo.PHOTO}, blank, empty, blank); try {if (cursor.moveToFirst ()) {byte [] data = cursor.getBlob ( 0); if (data! = Null) {array [0] = bitmapfender.oodestream (new bytereinputstream (data));}}} Finally {cursor.close ();} if (array [0]! = Null) {ToSet.setImageBitmap (array [0]);}}
Comments
Post a Comment