I have made an appWidget with a collection view. And in order to handle a click event on each view of the collection view, I used 'setPendingIntentTemplate' and 'setOnClickFillInIntent'. It is working fine in a normal case. It opens up the target activity by sending the intent upon click. But if an invalid uri (it is just not a valid uri for the target activity, but in syntax, it is a valid uri.) is injected to the intent for it, the widget just simply doesn't handle the click event. It doesn't throw any exception or return any error.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
view.setOnClickFillInIntent(R.id.image, intent);
Is there any way to catch this error (the click event is not being handled due to the intent with an invalid uri)? - So that, I can switch to different code to handle the situation.