Exemplo n.º 1
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {

    Log.d(TAG, "I'm here in ImageCollector's onActivityResult");

    if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == Activity.RESULT_OK) {

      int iBWidth = mImageButton.getWidth();
      int iBHeight = mImageButton.getHeight();

      // First decode with inJustDecodeBounds=true to check dimensions
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inJustDecodeBounds = true;
      BitmapFactory.decodeFile(mCurrentPhotoPath, options);

      // Calculate inSampleSize
      options.inSampleSize = ImageAdapter.calculateInSampleSize(options, iBWidth, iBHeight);
      options.inJustDecodeBounds = false;

      mImageButton.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
      mImageButton.setImageBitmap(BitmapFactory.decodeFile(mCurrentPhotoPath, options));

      GridView imageGrid = (GridView) findViewById(R.id.image_collector_grid);
      imageGrid.setAdapter(mAdapter);
      // mAdapter.loadBitmap(mImageButton, mThumbPosition);
      // mAdapter.notifyDataSetChanged();
    } else Log.d(TAG, "Image Capture Failed or Cancelled");
  }