android - Button Contacts : couldn't save which view has focus because the focused view.com has no id -
error: couldn't save view has focus because focused view com.android.internal.policy.impl.phonewindow$decorview@40556f58 has no id
here code:
intent intent = new intent(intent.action_pick, contactscontract.contacts.content_uri); startactivityforresult(intent,pick_contact );
and result:
public void onactivityresult(int reqcode, int resultcode, intent data) { super.onactivityresult(reqcode, resultcode, data); switch(reqcode) { case (pick_contact): if (resultcode == activity.result_ok) { uri contactdata = data.getdata(); cursor c = managedquery(contactdata, null, null, null, null); if (c.movetofirst()) { string id = c.getstring(c.getcolumnindexorthrow(contactscontract.contacts._id)); string hasphone = c.getstring(c.getcolumnindex(contactscontract.contacts.has_phone_number)); if (hasphone.equalsignorecase("1")) { cursor phones = getcontentresolver().query( contactscontract.commondatakinds.phone.content_uri,null, contactscontract.commondatakinds.phone.contact_id +" = "+ id, null, null); phones.movetofirst(); string phn_no = phones.getstring(phones.getcolumnindex("data1")); string name = c.getstring(c.getcolumnindex(structuredpostal.display_name)); //toast.maketext(this, "contact info : "+ phn_no+"\n"+name, toast.length_long).show(); phn_no = phn_no.replace("+", ""); phn_no = phn_no.replace("-", ""); phn_no = phn_no.replace(" ", ""); phn_no = phn_no.replace("#", ""); phn_no = phn_no.replace("@", ""); phn_no = phn_no.replace("*", ""); phn_no = phn_no.replace(".", ""); system.out.println("masuk method ini"); // toast.maketext(parent, phn_no, 2).show(); txthape.settext(phn_no); } } } } }
i add permition on manifest like:
<uses-permission android:name="android.permission.read_contacts"/>
what should solved problem?
Comments
Post a Comment