public static void Handle(IRestResponse response, Action <GetContactListResponse> successCallback) { new Thread(() => { bool responseCodeOk = CheckResponseCode(response); if (responseCodeOk && response != null) { GetContactListResponse getContactListResponse = JsonConvert.DeserializeObject <GetContactListResponse>(response.Content); successCallback?.Invoke(getContactListResponse); } }).Start(); }
private static void OnSucessGetContactListResponse(GetContactListResponse getContactListResponse) { int contactCount = getContactListResponse.count; for (int i = 0; i < contactCount; i++) { ContactItem item = new ContactItem(); item.ContactImage = Resource.Drawable.first; item.Name = getContactListResponse.data[i].firstName + " " + getContactListResponse.data[i].lastName; item.EmailAdress = getContactListResponse.data[i].emails[0].email; item.PhoneNumber = getContactListResponse.data[i].phoneNumbers[0].number; someList.Add(item); } Intent intent = new Intent(mContext, typeof(ContactListActivity)); intent.PutExtra("array", JsonConvert.SerializeObject(someList)); someList.Clear(); intent.PutExtra("authToken", authToken); intent.AddFlags(ActivityFlags.ClearTask | ActivityFlags.ClearTop); mContext.StartActivity(intent); }