From 0d28b46de1eaf4a5c887f635cb37be6c568ffc6d Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Sat, 30 Sep 2023 22:58:49 +0500 Subject: [PATCH] improve error report --- test-app/app/src/debug/java/com/tns/ErrorReport.java | 10 +++++++++- test-app/app/src/debug/res/layout/error_activity.xml | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test-app/app/src/debug/java/com/tns/ErrorReport.java b/test-app/app/src/debug/java/com/tns/ErrorReport.java index 0444456af..d2b5cf2d6 100644 --- a/test-app/app/src/debug/java/com/tns/ErrorReport.java +++ b/test-app/app/src/debug/java/com/tns/ErrorReport.java @@ -415,13 +415,21 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa int errorExceptionViewId = activity.getResources().getIdentifier("errorException", "id", activity.getPackageName()); TextView errorExceptionView = (TextView) activity.findViewById(errorExceptionViewId); + errorExceptionView.setMovementMethod(new ScrollingMovementMethod()); int errorStackTraceViewId = container.getContext().getResources().getIdentifier("errorStacktrace", "id", container.getContext().getPackageName()); TextView errorStackTraceView = (TextView) view.findViewById(errorStackTraceViewId); String[] exceptionParts = exceptionMsg.split("StackTrace:"); String error = exceptionParts[0]; - String trace = exceptionParts.length > 1 ? exceptionParts[1] : null; + String trace = ""; + + if (exceptionParts.length > 1) { + for (int i=0;i < exceptionParts.length;i++) { + if (i == 0) continue; + trace += exceptionParts[i]; + } + } errorExceptionView.setText(error.trim()); diff --git a/test-app/app/src/debug/res/layout/error_activity.xml b/test-app/app/src/debug/res/layout/error_activity.xml index 1a5227e6e..9e614f6f3 100644 --- a/test-app/app/src/debug/res/layout/error_activity.xml +++ b/test-app/app/src/debug/res/layout/error_activity.xml @@ -15,8 +15,11 @@ android:layout_height="wrap_content" android:text="" android:background="@color/red" - android:textSize="17sp" + android:textSize="16sp" android:paddingLeft="16dp" + android:textIsSelectable="true" + android:maxHeight="200dp" + android:scrollbars="vertical" android:textColor="@color/white" android:paddingVertical="10dp" android:paddingRight="16dp" />