Android: replace stacktrace with debug message in search for setActivity
Don't print stacktrace when setActivity is not found but only print a debug message, QtActivityDelegate will continue to look for setContext which might actually be a problem if not implemented. Fixes: QTBUG-86733 Pick-to: 5.15.2 Change-Id: Iaf7f347ae04605a1f616f24d25cac4938c1640a4 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
This commit is contained in:
parent
90912b657e
commit
950e628fd8
@ -95,6 +95,7 @@ import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.qtproject.qt.android.accessibility.QtAccessibilityDelegate;
|
||||
|
||||
@ -592,7 +593,7 @@ public class QtActivityDelegate
|
||||
QtNative.setActivity(m_activity, this);
|
||||
QtNative.setClassLoader(classLoader);
|
||||
if (loaderParams.containsKey(STATIC_INIT_CLASSES_KEY)) {
|
||||
for (String className: loaderParams.getStringArray(STATIC_INIT_CLASSES_KEY)) {
|
||||
for (String className: Objects.requireNonNull(loaderParams.getStringArray(STATIC_INIT_CLASSES_KEY))) {
|
||||
if (className.length() == 0)
|
||||
continue;
|
||||
|
||||
@ -603,9 +604,10 @@ public class QtActivityDelegate
|
||||
Method m = initClass.getMethod("setActivity", Activity.class, Object.class);
|
||||
m.invoke(staticInitDataObject, m_activity, this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.d(QtNative.QtTAG, "Class " + className + " does not implement setActivity method");
|
||||
}
|
||||
|
||||
// For modules that don't need/have setActivity
|
||||
try {
|
||||
Method m = initClass.getMethod("setContext", Context.class);
|
||||
m.invoke(staticInitDataObject, (Context)m_activity);
|
||||
|
Loading…
Reference in New Issue
Block a user