From bf8e6de2368921490363dc26c0e1a7116287de0f Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 27 Oct 2022 18:30:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=8F=8D=E9=A6=88=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shayu/phonelive/AppContext.java | 2 +- .../com/yunbao/common/bean/CrashSaveBean.java | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index a2c30e01c..ba2f78824 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -117,7 +117,7 @@ public class AppContext extends CommonAppContext { @Override public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) { activities.add(new WeakReference<>(activity)); - CrashSaveBean.getInstance().setActivitySize(activities.size()); + CrashSaveBean.getInstance().setActivitySize(activities); } @Override diff --git a/common/src/main/java/com/yunbao/common/bean/CrashSaveBean.java b/common/src/main/java/com/yunbao/common/bean/CrashSaveBean.java index c6a0bb684..d29298124 100644 --- a/common/src/main/java/com/yunbao/common/bean/CrashSaveBean.java +++ b/common/src/main/java/com/yunbao/common/bean/CrashSaveBean.java @@ -1,5 +1,10 @@ package com.yunbao.common.bean; +import android.app.Activity; + +import java.lang.ref.WeakReference; +import java.util.List; + /** * 用于统计记录崩溃的数据 */ @@ -9,7 +14,7 @@ public class CrashSaveBean { private long enterRoom;//进入房间次数 private long slidingRoom;//滑动直播间次数 private long playSvga;//加载播放svga次数 - private long activitySize;//Activity数量 + private List> activities;//Activity数量 private CrashSaveBean() { @@ -54,12 +59,18 @@ public class CrashSaveBean { slidingRoom++; } - public long getActivitySize() { - return activitySize; + public String getActivitySize() { + StringBuilder builder=new StringBuilder(); + for (WeakReference activity : activities) { + if(activity.get()!=null){ + builder.append(activity.get()).append(","); + } + } + return builder.toString(); } - public void setActivitySize(long activitySize) { - this.activitySize = activitySize; + public void setActivitySize(List> activitySize) { + this.activities = activitySize; } }