How to concatenate string in data binding. I want to show both firstName and lastName is same TextView. Any help thanks in advance.
<data>
<variable
name="task"
type="com.myapp.app.Task" />
</data>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:drawablePadding="6dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="@={task.assignedTo.firstName}"//how to include lastname
android:textColor="@color/textBlack"
android:textSize="14sp"
tools:text="Saikiran" />
First of all there should not be
=
after@
because it indicates two-way binding and there is no meaning of two-way binding withTextView
.To concate last name you can use
+
operatorand to concate it with some custom String :