public virtual void setViewBinder(android.widget.SimpleAdapter.ViewBinder arg0) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { @__env.CallVoidMethod(this.JvmHandle, global::android.widget.SimpleAdapter._setViewBinder11914, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)); } else { @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.SimpleAdapter.staticClass, global::android.widget.SimpleAdapter._setViewBinder11914, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0)); } }
/// <summary>Sets the binder used to bind data to views.</summary> /// <remarks>Sets the binder used to bind data to views.</remarks> /// <param name="viewBinder"> /// the binder used to bind data to views, can be null to /// remove the existing binder /// </param> /// <seealso cref="getViewBinder()">getViewBinder()</seealso> public virtual void setViewBinder(android.widget.SimpleAdapter.ViewBinder viewBinder ) { mViewBinder = viewBinder; }
private void bindView(int position, android.view.View view) { java.util.Map <string, object> dataSet = mData.get(position); if (dataSet == null) { return; } android.widget.SimpleAdapter.ViewBinder binder = mViewBinder; string[] from = mFrom; int[] to = mTo; int count = to.Length; { for (int i = 0; i < count; i++) { android.view.View v = view.findViewById(to[i]); if (v != null) { object data = dataSet.get(from[i]); string text = data == null ? string.Empty : data.ToString(); if (text == null) { text = string.Empty; } bool bound = false; if (binder != null) { bound = binder.setViewValue(v, data, text); } if (!bound) { if (v is android.widget.Checkable) { if (data is bool) { ((android.widget.Checkable)v).setChecked((bool)data); } else { if (v is android.widget.TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views are TextViews (e.g. CheckBoxes). setViewText((android.widget.TextView)v, text); } else { throw new System.InvalidOperationException(v.GetType().FullName + " should be bound to a Boolean, not a " + (data == null ? "<unknown type>" : data.GetType().ToString())); } } } else { if (v is android.widget.TextView) { // Note: keep the instanceof TextView check at the bottom of these // ifs since a lot of views are TextViews (e.g. CheckBoxes). setViewText((android.widget.TextView)v, text); } else { if (v is android.widget.ImageView) { if (data is int) { setViewImage((android.widget.ImageView)v, (int)data); } else { setViewImage((android.widget.ImageView)v, text); } } else { throw new System.InvalidOperationException(v.GetType().FullName + " is not a " + " view that can be bounds by this SimpleAdapter"); } } } } } } } }