Skip to content

Commit a0cc20b

Browse files
committed
Fixed java.lang.ClassCastException: com.facebook.react.views.text.ReactTextView cannot be cast to android.view.ViewGroup
at com.surcumference.fingerprint.util.ViewUtils.findViewByName(ViewUtils.java:146) at com.surcumference.fingerprint.plugin.impl.unionpay.UnionPayBasePlugin.showFingerPrintDialog(UnionPayBasePlugin.java:154) at com.surcumference.fingerprint.plugin.impl.unionpay.UnionPayBasePlugin$2.onGlobalLayout(UnionPayBasePlugin.java:130) at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1061) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3550) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2398) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9407) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1218) at android.view.Choreographer.doCallbacks(Choreographer.java:972) at android.view.Choreographer.doFrame(Choreographer.java:872) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1203) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:233) at android.os.Looper.loop(Looper.java:344) at android.app.ActivityThread.main(ActivityThread.java:8204)
1 parent 44adc7d commit a0cc20b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/src/main/java/com/surcumference/fingerprint/util/ViewUtils.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ public static View findViewByName(View rootView, String packageName, String... n
140140
continue;
141141
}
142142
List<View> viewList = new ArrayList<>();
143-
getChildViews((ViewGroup) rootView, id, viewList);
143+
if (rootView instanceof ViewGroup) {
144+
getChildViews((ViewGroup) rootView, id, viewList);
145+
}
144146
sortViewListByYPosition(viewList);
145147
int outViewListSize = viewList.size();
146148
if (outViewListSize == 1) {
@@ -161,7 +163,9 @@ public static View findViewByName(View rootView, String packageName, String... n
161163
public static View findViewByText(View rootView, String... names) {
162164
for (String name : names) {
163165
List<View> viewList = new ArrayList<>();
164-
getChildViews((ViewGroup) rootView, name, viewList);
166+
if (rootView instanceof ViewGroup) {
167+
getChildViews((ViewGroup) rootView, name, viewList);
168+
}
165169
int outViewListSize = viewList.size();
166170
if (outViewListSize == 1) {
167171
return viewList.get(0);

0 commit comments

Comments
 (0)