Skip to content
This repository has been archived by the owner on May 30, 2021. It is now read-only.

Commit

Permalink
* handle an exception when video picker failed #36
Browse files Browse the repository at this point in the history
  • Loading branch information
alhazmy13 committed Dec 6, 2017
1 parent 1a2d996 commit 6356392
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ protected void onRestoreInstanceState(Bundle savedInstanceState) {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(VideoTags.Tags.TAG, "onActivityResult() called with: " + "requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data + "]");
if (mVideoConfig.debug)
Log.d(VideoTags.Tags.TAG, "onActivityResult() called with: " + "requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data + "]");
if (resultCode == RESULT_OK) {
switch (requestCode) {
case VideoTags.IntentCode.CAMERA_REQUEST:
Expand All @@ -201,7 +202,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
} else {
Intent intent = new Intent();
intent.setAction(VideoTags.Action.SERVICE_ACTION);
intent.putExtra(VideoTags.Tags.PICK_ERROR, "user did not select any image");
intent.putExtra(VideoTags.Tags.PICK_ERROR, "user did not select any videos");
sendBroadcast(intent);
finish();
}
Expand All @@ -213,8 +214,14 @@ private void processOneImage(Intent data) {
String path = FileProcessing.getVideoPath(selectedImage, VideoActivity.this);
new VideoActivity.CompressImageTask(path,
mVideoConfig, VideoActivity.this).execute();

} catch (Exception ex) {
ex.printStackTrace();
Intent intent = new Intent();
intent.setAction(VideoTags.Action.SERVICE_ACTION);
intent.putExtra(VideoTags.Tags.PICK_ERROR, "Issue with video path: " + ex.getMessage());
sendBroadcast(intent);
setResult(RESULT_CANCELED, intent);
finish();
}

}
Expand Down

0 comments on commit 6356392

Please sign in to comment.