मैं एंड्रॉइड के डेटा बाइंडिंग लाइब्रेरी का उपयोग कर रहा हूं। मेरे पास BaseObservable
का विस्तार करने वाला मेरा डेटा ऑब्जेक्ट है।एंड्रॉइड: डाटाबेसिंग, सूचित करेंप्रॉपर्टी चेंज() काम नहीं कर रहा है?
public static class SimpleData extends BaseObservable implements Serializable {
private String text, subText;
private SpannableString totalText;
@Bindable
public SpannableString getTotalText() {
return totalText;
}
public void setTotalText(SpannableString totalText) {
this.totalText = totalText;
notifyPropertyChanged(BR.totalText);
}
}
और मेरे एक्सएमएल
<TextView
android:id="@+id/patient_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="16dp"
android:layout_toRightOf="@+id/patient_image"
android:textColor="@color/primary_text"
android:text="@{object.getTotalText()}"
/>
बाध्यकारी प्रारंभिक मान के लिए जगह लेता है के रूप में अच्छी तरह से आबद्ध है। लेकिन जब मैं
object.setTotalText(someSpannableString);
का उपयोग करके मान बदलता है तो टेक्स्ट दृश्य में परिवर्तन दिखाई नहीं देते हैं। क्या समस्या हो सकती है?
क्या आप अपनी समस्या का समाधान कर सकते हैं सर? –
@mahdipishguy: नहीं सर। समस्या अभी तक हल नहीं हुई है – Ashwin