From ce6f3839758b5f34ac536c707f05d1aa78d4e3bc Mon Sep 17 00:00:00 2001 From: Amaury Esparza Date: Thu, 31 Jul 2014 22:26:12 -0500 Subject: [PATCH] Update IntentTestActivity.java It's not better ensure the intent could be resolved? regards! --- .../samples/integration/IntentTestActivity.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CatchNotesIntegration/src/com/catchnotes/samples/integration/IntentTestActivity.java b/CatchNotesIntegration/src/com/catchnotes/samples/integration/IntentTestActivity.java index 3d807f9..f557e79 100644 --- a/CatchNotesIntegration/src/com/catchnotes/samples/integration/IntentTestActivity.java +++ b/CatchNotesIntegration/src/com/catchnotes/samples/integration/IntentTestActivity.java @@ -50,8 +50,10 @@ public void onClick(View v) { public void onClick(View v) { Intent galleryIntent = new Intent(Intent.ACTION_PICK); galleryIntent.setType("image/*"); - startActivityForResult(Intent.createChooser(galleryIntent, - "Choose from:"), IMAGE_PICKED); + if(galleryIntent.resolveActivity(getPackageManager()) != null){ + startActivityForResult(Intent.createChooser(galleryIntent, + "Choose from:"), IMAGE_PICKED); + } } }); @@ -123,4 +125,4 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } -} \ No newline at end of file +}