Context: handle startActivity() always asynchron

This commit is contained in:
Julian Winkler
2025-10-26 17:24:24 +01:00
parent 3abbef5117
commit c4e7d27b9b

View File

@@ -661,7 +661,7 @@ public class Context extends Object {
} }
final String className_ = className; final String className_ = className;
final Intent intent_ = intent; final Intent intent_ = intent;
Runnable runnable = new Runnable() { new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
@@ -676,12 +676,7 @@ public class Context extends Object {
e.printStackTrace(); e.printStackTrace();
} }
} }
}; });
if (Looper.myLooper() == Looper.getMainLooper()) {
runnable.run();
} else {
new Handler(Looper.getMainLooper()).post(runnable);
}
} }
public void startActivity(Intent intent, Bundle options) { public void startActivity(Intent intent, Bundle options) {