@Override public void onClick(View v) { Uri uri = MediaDAO.getLastPhotoFromCameraPhotos(getApplicationContext()); if (uri.toString().equals("")) { NotificationUtil.makeToast( getApplicationContext(), getResources().getString(R.string.no_camera_photos)); } else { final GCAccountMediaModel model = new GCAccountMediaModel(); model.setLargeUrl(uri.toString()); model.setThumbUrl(uri.toString()); model.setUrl(uri.toString()); IntentUtil.deliverDataToInitialActivity( ChooseServiceActivity.this, model, ppWrapper.getChuteId()); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { if (requestCode == GCAccountStore.AUTHENTICATION_REQUEST_CODE) { GCAccounts.all(getApplicationContext(), new AccountsCallback()).executeAsync(); } if (requestCode == PhotosIntentWrapper.ACTIVITY_FOR_RESULT_STREAM_KEY) { finish(); } else if (requestCode == Constants.CAMERA_PIC_REQUEST) { // Bitmap image = (Bitmap) data.getExtras().get("data"); String path = ""; File tempFile = AppUtil.getTempFile(getApplicationContext()); if (AppUtil.hasImageCaptureBug() == false && tempFile.length() > 0) { try { android.provider.MediaStore.Images.Media.insertImage( getContentResolver(), tempFile.getAbsolutePath(), null, null); tempFile.delete(); path = MediaDAO.getLastPhotoFromCameraPhotos(getApplicationContext()).toString(); } catch (FileNotFoundException e) { Log.d(TAG, "", e); } } else { Log.e(TAG, "Bug " + data.getData().getPath()); path = Uri.fromFile(new File(AppUtil.getPath(getApplicationContext(), data.getData()))) .toString(); } Log.d(TAG, path); final GCAccountMediaModel model = new GCAccountMediaModel(); model.setLargeUrl(path); model.setThumbUrl(path); model.setUrl(path); IntentUtil.deliverDataToInitialActivity(this, model, ppWrapper.getChuteId()); } } }