How do I use databinding to combine a string from resources with a dynamic variable in XML?

I have a TextView which has a hardcoded string and I have a dynamic variable that I want to put at the end of this string. This is my code: <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical” android:layout_marginLeft=”16dp” android:layout_marginRight=”16dp”> <TextView android:id=”@+id/PeopleName” android:layout_width=”match_parent” android:layout_height=”match_parent” android:text=”@string/Generic_Text”+”@{ Profile.name }” /> </LinearLayout> I am having an issue with android:text=”@string/Generic_Text”+”@{ Profile.name }” . … Read more

How to use data-binding with Fragment

I’m trying to follow data-binding example from official google doc https://developer.android.com/tools/data-binding/guide.html except that I’m trying to apply data-biding to a fragment, not an activity. the error I’m currently getting when compiling is Error:(37, 27) No resource type specified (at ‘text’ with value ‘@{marsdata.martianSols}. onCreate for fragment looks like this: @Override public void onCreate(@Nullable Bundle savedInstanceState) … Read more