Skip to content

Commit 8d9c464

Browse files
committed
External activity failure - ignore resolveActivity
1 parent 590a415 commit 8d9c464

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

app/src/main/java/com/samsung/microbit/ui/UIUtils.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -336,25 +336,29 @@ public static int safelyStartActivity( Context context, boolean report, Intent i
336336
int error = 0;
337337
ComponentName componentName = intent.resolveActivity( context.getPackageManager());
338338
if ( componentName == null) {
339+
/* TODO: Why is componentName null for
340+
ACTION_CREATE_DOCUMENT (unless createChooser is used)
341+
ACTION_VIEW?
342+
*/
339343
Log.i(TAG,"startActivity - no component");
340-
error = 1;
341-
} else {
342-
try {
343-
if ( forResult) {
344-
if ( !(context instanceof Activity)) {
345-
error = 3;
346-
} else {
347-
((Activity) context).startActivityForResult(intent, requestCode, options);
348-
}
344+
}
345+
346+
try {
347+
if ( forResult) {
348+
if ( !(context instanceof Activity)) {
349+
error = 3;
349350
} else {
350-
context.startActivity(intent);
351+
((Activity) context).startActivityForResult(intent, requestCode, options);
351352
}
352-
} catch (Exception e) {
353-
Log.i(TAG, "startActivity - exception");
354-
e.printStackTrace();
355-
error = 2;
353+
} else {
354+
context.startActivity(intent);
356355
}
356+
} catch (Exception e) {
357+
Log.i(TAG, "startActivity - exception");
358+
e.printStackTrace();
359+
error = 2;
357360
}
361+
358362
if ( report && error != 0) {
359363
safelyStartActivityToastGeneric( context);
360364
}

0 commit comments

Comments
 (0)