private void OnSpeakersQueryComplete(ICursor cursor) { try { mSpeakersCursor = true; // TODO: remove any existing speakers from layout, since this cursor // might be from a data change notification. ViewGroup speakersGroup = mRootView.FindViewById <ViewGroup> (Resource.Id.session_speakers_block); LayoutInflater inflater = Activity.LayoutInflater; bool hasSpeakers = false; while (cursor.MoveToNext()) { String speakerName = cursor.GetString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.IsEmpty(speakerName)) { continue; } String speakerImageUrl = cursor.GetString(SpeakersQuery.SPEAKER_IMAGE_URL); String speakerCompany = cursor.GetString(SpeakersQuery.SPEAKER_COMPANY); String speakerUrl = cursor.GetString(SpeakersQuery.SPEAKER_URL); String speakerAbstract = cursor.GetString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.IsEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } var speakerView = inflater.Inflate(Resource.Layout.speaker_detail, speakersGroup, false); var speakerHeaderView = speakerView.FindViewById <TextView> (Resource.Id.speaker_header); var speakerImgView = speakerView.FindViewById <ImageView> (Resource.Id.speaker_image); var speakerUrlView = speakerView.FindViewById <TextView> (Resource.Id.speaker_url); var speakerAbstractView = speakerView.FindViewById <TextView> (Resource.Id.speaker_abstract); if (!TextUtils.IsEmpty(speakerImageUrl)) { BitmapUtils.FetchImage(Activity, new Java.Lang.String(speakerImageUrl), null, null, (result) => { Activity.RunOnUiThread(() => { speakerImgView.SetImageBitmap(result); }); }); } speakerHeaderView.Text = speakerHeader; UIUtils.SetTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.IsEmpty(speakerUrl)) { UIUtils.SetTextMaybeHtml(speakerUrlView, speakerUrl); speakerUrlView.Visibility = ViewStates.Visible; } else { speakerUrlView.Visibility = ViewStates.Gone; } speakersGroup.AddView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.Visibility = (hasSpeakers ? ViewStates.Visible : ViewStates.Gone); // Show empty message when all data is loaded, and nothing to show if (mSessionCursor && !mHasSummaryContent) { mRootView.FindViewById(Android.Resource.Id.Empty).Visibility = ViewStates.Visible; } } finally { if (null != cursor) { cursor.Close(); } } }