android - Databinding Error: old values should be followed by new values. Parameter 2 must be the same type as parameter 3 -
i using data binding custom fields. have set custom data binding adapter this.
my binding adapter looks this:
@bindingadapter({"created_by,created_at"}) public static void setdetailcreated(textview textview, string createdby, long createdat) { calendar cal = calendar.getinstance(); cal.settimeinmillis(createdat); simpledateformat dateformat = new simpledateformat("h:mm a, dd mmm yyyy"); string format = textview.getcontext().getstring(r.string.details_created, createdby, dateformat.format(cal.gettime())); textview.settext(format); }
and in layout file have:
... <data> <import type="java.util.map" /> <import type="com.example.beans.friend" /> <variable name="user" type="com.example.beans.user" /> <variable name="friends" type="map<string, friend>" /> </data> .... .... <textview android:layout_width="match_parent" android:layout_height="wrap_content" app:created_by="@{friends[user.createdby].name}" app:created_at="@{user.createdat}" />
but while running getting below error:
error:execution failed task ':app:compiledebugjavawithjavac'. java.lang.runtimeexception: failure, see logs details. bindingadapter setdetailcreated(android.widget.textview,java.lang.string,long): old values should followed new values. parameter 2 must same type parameter 3.
i don't understand going wrong here?
error within bindingadapter
, should be
@bindingadapter({"created_by","created_at"}) public static void setdetailcreated(textview textview, string createdby, long createdat){ }
all values should comma seperated , in double quotes.
Comments
Post a Comment