memory - MemoryFile.finalize() called while ashmem still open - How to deal with it - Android -
i have seen questions @ regarding same question, none of them has accepted answer.
what error informing? why occur?
i have few cursors in application, , did close them, after work done. error still shows up. reason?
here code :::
private string fetchcontactidfromphonenumber(string phonenumber) { // todo auto-generated method stub uri uri = uri.withappendedpath(phonelookup.content_filter_uri, uri.encode(phonenumber)); cursor cfetch = getcontentresolver().query(uri, new string[] { phonelookup.display_name, phonelookup._id }, null, null, null); string contactid = ""; if (cfetch.movetofirst()) { cfetch.movetofirst(); contactid = cfetch.getstring(cfetch .getcolumnindex(phonelookup._id)); } //system.out.println(contactid); if(cfetch != null) { cfetch.close(); } return contactid; } public uri getphotouri(long contactid) { contentresolver contentresolver = getcontentresolver(); cursor cursor; try { cursor = contentresolver .query(contactscontract.data.content_uri, null, contactscontract.data.contact_id + "=" + contactid + " , " + contactscontract.data.mimetype + "='" + contactscontract.commondatakinds.photo.content_item_type + "'", null, null); if (cursor != null) { if (!cursor.movetofirst()) { return null; // no photo } } else { return null; // error in cursor process } } catch (exception e) { e.printstacktrace(); return null; } if(cursor != null) { cursor.close(); } uri person = contenturis.withappendedid( contactscontract.contacts.content_uri, contactid); return uri.withappendedpath(person, contactscontract.contacts.photo.content_directory); }
this code use cursors. have contentresolver object. should close well?
and finally, impact on error on application, because, doesn't seem interrupt application's execution.
Comments
Post a Comment