Skip to content

Commit

Permalink
Catch exception and toast message when file picker activity is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
protyposis committed Nov 12, 2016
1 parent 9ea8f8d commit 411e1b2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Intent;
import android.graphics.Color;
Expand Down Expand Up @@ -92,7 +93,11 @@ public void onClick(View v) {
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_MIME_TYPES, new String[]{"video/*", "audio/*"});
}
startActivityForResult(intent, REQUEST_LOAD_VIDEO);
try {
startActivityForResult(intent, REQUEST_LOAD_VIDEO);
} catch (ActivityNotFoundException e) {
Toast.makeText(MainActivity.this, "Your device seems to lack a file picker", Toast.LENGTH_SHORT).show();
}
}
});
mVideoSelect2Button.setOnClickListener(new View.OnClickListener() {
Expand Down

0 comments on commit 411e1b2

Please sign in to comment.