android - How to return result from onActivityresult -


I am trying to contact the default contact app. I successfully got information from a contact. Now I want to save this data in the array list, in the type of contact. How onActivityResult? I am searching for it for 5 hours. I am new to Android.

Here is the code for my on-activative result

  Active Result on Public Zero (result code, intent data of int record, int) {super.onActivityResult (reqCode) , Resultcode, data); Switch (Rickcode) {case (PICK_CONTACT): if (resultCode == RESULT_OK) {Ure contact data = data .getData (); ContentResolver cr = getContentResolver (); Cursor c = cr.query (contact data, empty, blank, null, empty); If (c.moveToFirst ()) {string id = cgetstring (c .getColumnIndexOrThrow (contact contact ._id)); Long CID = (double) double. Prsd double (id); String name = cgetstring (c .getColumnIndex (ContactsContract.Contacts.DISPLAY_NAME)); Int isfnumber = c .getInt (c.getColumnIndex (contactsContract.Contacts.HAS_PHONE_NUMBER)); If (HephoneNumber> 0) {// this contact cursor phone cassor = CR.C .. (ContactContact.com.comDataDind.ContentSourceI, Blank, ContactContact.comCommandityind.Phone.Contak_ID + "=?", New string [] {ID }, Zero); While (phoneCursor.moveToNext ()) {String PhoneNumber = Phone Coupons .getString (Phonecars .getColumnIndex (ContactsContract.CommonDataKinds.Phone.NUMBER)); Toast. Make text (getApplicationContext (), id + "+ + +" + + phone number, toast. Lnnhh_leng). Show (); } Phonecars Close (); }}}}}}    

after specifying the value

String Phone Number = Phone Cursor .getString (Phonecars .getColumnIndex (ContactsContract.CommonDataKinds.Phone.NUMBER));

Store the same value in the INTENT object

intimation data

such as data.putExtra ("phone number", phone number);

And after starting the new activity which you want to invoke like below

startActivity (new intent (Intent.ACTION_VIEW, data));

In the new activity, the above value is intent.

Intention with Phonephone = get points (); (Zero! = Int'l Phonephone Numbers.getExtras ()) {PhoneNumbers.getExtras (with string phone number = intent) GetString ("phone number"); }

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -