问题描述
我在项目中实施了华为DTM,
具有依赖项:
implementation 'com.huawei.hms:dtm-api:5.0.0.301'
我将事件添加到如下所示的布局中,但是当我单击该项目时,没有响应。
布局代码:
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onReport"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@mipmap/ic_launcher" />
</androidx.appcompat.widget.LinearLayoutCompat>
和我的onReport函数:
public void onReport(View view) {
Bundle bundle = new Bundle();
bundle.putDouble("Price",9.99);
bundle.putDouble("Money",9.99);
if (instance != null) {
instance.onEvent("Purchase",bundle);
}
}
知道我做错了哪一部分吗?
解决方法
您需要在子布局上添加事件报告,但不适用于主布局。
在DTM的下一发行版中,将解决此问题。