@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "new command created, resultCode = " + resultCode); super.onActivityResult(requestCode, resultCode, data); if (data != null) { int msg = data.getIntExtra("returnedData", -1); if (resultCode == RESULT_OK && requestCode == 12) { switch (msg) { case Constants.COMMAND_TIMED: Toast.makeText(this, getString(R.string.command_inserted), Toast.LENGTH_SHORT).show(); break; case Constants.COMMAND_COMEBACK_CODE: // fall throught case Constants.COMMAND_GOAWAY_CODE: Toast.makeText(this, getString(R.string.command_inserted), Toast.LENGTH_SHORT).show(); break; case Constants.COMMAND_TRIGGERED: Toast.makeText(this, getString(R.string.command_inserted), Toast.LENGTH_SHORT).show(); break; default: Toast.makeText(this, getString(R.string.command_inserted_fail), Toast.LENGTH_LONG) .show(); break; } } else { Toast.makeText(this, getString(R.string.command_inserted_fail), Toast.LENGTH_LONG).show(); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); Log.i(Constants.TAG, "SAVED IMG RESULT:" + resultCode); if (resultCode == RESULT_OK) { Uri selectedImage = imageReturnedIntent.getData(); Log.i(Constants.TAG, "SAVED IMG PATH:" + selectedImage.toString()); tags[requestCode].setImagePath(selectedImage.toString()); // String[] filePathColumn = {MediaStore.Images.Media.DATA}; datasource.createOrUpdateTag(tags[requestCode]); // Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath); Log.i(Constants.TAG, "SAVED IMG PATH:" + tags[requestCode].getImagePath()); tagAdapter.notifyItemChanged(requestCode); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); Log.i(Constants.TAG, "SAVING IMG RESULT:" + resultCode); if (resultCode == RESULT_OK) { Uri selectedImage = imageReturnedIntent.getData(); Log.i(Constants.TAG, "RESULT_OK PATH:" + selectedImage.toString()); collected.setImagePath(selectedImage.toString()); // String[] filePathColumn = {MediaStore.Images.Media.DATA}; db.createOrUpdateTag(collected); // Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath); Log.i(Constants.TAG, "SAVED IMG PATH:" + collected.getImagePath()); } FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); TagDetailFragment fragment = new TagDetailFragment(); transaction.replace(R.id.detailPane, fragment); transaction.commit(); }