title: Picture coming from camera or gallery?
body: <p>I have an intent chooser that allows me to pick image from gallery or camera like this:</p>
  
  <pre><code>    Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT,null);
      galleryIntent.setType("image/*");
      galleryIntent.addCategory(Intent.CATEGORY_OPENABLE);
  
      Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
  
  
      Intent chooser = new Intent(Intent.ACTION_CHOOSER);
      chooser.putExtra(Intent.EXTRA_INTENT, galleryIntent);      
      chooser.putExtra(Intent.EXTRA_TITLE, "title");
  
      Intent[] intentArray =  {cameraIntent}; 
      chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
      startActivityForResult(chooser,REQUEST_CODE);
  </code></pre>
  
  <p>I want my <code>onActivityResult</code> method to be like this:</p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data)
  {
      if(Condition == picture_coming_from_gallery)
      {
       //my code here
      }
      else if(condition == picture_coming_from_camera)
      {
       //another code here
      }
  }
  </code></pre>
  
  <p>What is the condition that allows me to know which source my image is coming from?</p>
  
  <p><strong>Updated:</strong></p>
  
  <p>Now it's working and here is the solution:</p>
  
  <pre><code>    protected void onActivityResult(int requestCode, int resultCode, Intent data) 
  {
      if (requestCode == REQUEST_CODE &amp;&amp; resultCode == Activity.RESULT_OK)
      {
          if(data.getData()!=null)
          {
              try 
              {
              if (bitmap != null) 
                  {
                      bitmap.recycle();
                  }
  
              InputStream stream = getContentResolver().openInputStream(data.getData());
              bitmap = BitmapFactory.decodeStream(stream);
              stream.close();
              imageView.setImageBitmap(bitmap);
              }
  
          catch (FileNotFoundException e) 
              {
                  e.printStackTrace();
              }
  
          catch (IOException e) 
              {
                  e.printStackTrace();
              }
          } 
  
          else 
          {
              bitmap=(Bitmap) data.getExtras().get("data"); 
              imageView.setImageBitmap(bitmap);
          }
  
          super.onActivityResult(requestCode, resultCode, data);
      }
  }
  </code></pre>
  
  <p><strong>Thank you for you help!</strong></p>