title: I want to make a Dialog Screen Like WhatsApp Profile Photo Dialog Screen
body: <p>hello Friends....</p>
  
  <p>I am currently trying to make a Dialog using Implicit Intent where i want to show my Dialog like whatsApp(Profile Photo Screen) and in this screen whatsApp are using extra field named as "Remove Photo". When i try to make same type of screen Dialog then i am unable to add this extra field("Remove Photo"). i have done all code. its working fine for three option in Dialog like(Gallery,Photo,Camera) and i am unable to handle these all in onActivityResult() . I am sending my all source code  i have tried much hard , but i am not able to find the solution to do so. plz..... friends help me out from this.</p>
  
  <p>In this code i am simply create a method named as openFileChooser() in which i have write all the code for creating Dialog Screen and handle this outcomes in onActivityResult()</p>
  
  <p>Here Is my code </p>
  
  <p>ProfilePhotoActivity.java</p>
  
  <pre><code>public class ProfilePhotoActivity extends Activity implements OnClickListener{
      ImageButton back, editPhoto, selectAction;
      ImageView imgCamera;
      private static final int FILECHOOSER_RESULTCODE   = 2888;
      protected static final int CAMERA_REQUEST = 0;
      protected static final int GALLERY_PICTURE = 1;
      private Uri mCapturedImageURI = null;
      Intent intent;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                  WindowManager.LayoutParams.FLAG_FULLSCREEN);
          setContentView(R.layout.activity_profilephoto);
  
          back=(ImageButton)findViewById(R.id.btn_back);
          editPhoto=(ImageButton)findViewById(R.id.ibEditPhoto);
          selectAction=(ImageButton)findViewById(R.id.ibSelectAction);
  
          imgCamera=(ImageView)findViewById(R.id.imvProfilePhoto);
  
          editPhoto.setOnClickListener(this);
          selectAction.setOnClickListener(this);
          back.setOnClickListener(this);
      }
  
      @Override
      public void onClick(View v) {
  
          switch (v.getId()) {
          case R.id.btn_back:
              ProfilePhotoActivity.this.finish();
              break;
  
          case R.id.ibEditPhoto:
              openFileChooser(null, null);
          //  startDialog();
  
  
              break;
          case R.id.ibSelectAction:
              break;
          }
      }
  
       public void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg, String acceptType){  
  
              try{    
  
               // Create AndroidExampleFolder at sdcard
  
               File imageStorageDir = new File(
                 Environment.getExternalStoragePublicDirectory(
                   Environment.DIRECTORY_PICTURES)
                   , "AndroidExampleFolder");
  
               if (!imageStorageDir.exists()) {
                // Create AndroidExampleFolder at sdcard
                imageStorageDir.mkdirs();
               }
  
               // Create camera captured image file path and name 
               File file = new File(
                 imageStorageDir + File.separator + "IMG_"
                   + String.valueOf(System.currentTimeMillis()) 
                   + ".jpg");
  
               mCapturedImageURI = Uri.fromFile(file); 
  
               // Camera capture image intent
               final Intent captureIntent = new Intent(
                 android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  
               captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
  
               Intent i = new Intent(Intent.ACTION_PICK); 
              // i.addCategory(Intent.CATEGORY_OPENABLE);
               i.setType("image/*");
  
               // Create file chooser intent
               Intent chooserIntent = Intent.createChooser(i, "Image Chooser");
  
               // Set camera intent to file chooser 
               chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS
                 , new Parcelable[] { captureIntent });
  
               // On select image call onActivityResult method of activity
               startActivityForResult(chooserIntent, FILECHOOSER_RESULTCODE);
  
              }
              catch(Exception e){
               Toast.makeText(getBaseContext(), "Exception:"+e, 
                 Toast.LENGTH_LONG).show();
              }
  
             }
       protected void onActivityResult(int requestCode, int resultCode,Intent intent) { 
  
            if(requestCode==FILECHOOSER_RESULTCODE)  
            {  
                if (requestCode == GALLERY_PICTURE)
                      {
                          if (resultCode == RESULT_OK) 
                          {
                              if (intent != null) 
                              {                   
                                  // our BitmapDrawable for the thumbnail
                                  BitmapDrawable bmpDrawable = null;
  
                                  // try to retrieve the image using the data from the intent
                                  Cursor cursor = getContentResolver().query(intent.getData(), null, null, null, null);
  
                                  if (cursor != null) 
                                  {
                                      cursor.moveToFirst();
  
                                      int idx = cursor.getColumnIndex(ImageColumns.DATA);
                                      String fileSrc = cursor.getString(idx);
                                      Bitmap galleryBitmap = BitmapFactory.decodeFile(fileSrc); // load preview image                                                                         
                                      galleryBitmap = Bitmap.createScaledBitmap(galleryBitmap, 200, 200, true);
  
  
                                      String filePath = Environment.getExternalStorageDirectory()
                                      .getAbsolutePath()+"/TimeChat/image/"+System.currentTimeMillis()+".jpg";
  
                                      //imgCamera.setRotation(0);
                                      imgCamera.setImageBitmap(galleryBitmap);
  //                                  writeToFile(filePath, galleryBitmap);
                                  } 
                                  else 
                                  {
                                      bmpDrawable = new BitmapDrawable(getResources(), intent.getData().getPath());
                                      imgCamera.setImageDrawable(bmpDrawable);
                                  }
                              } 
                              else 
                              {
                                  Toast.makeText(getApplicationContext(), "Cancelled", Toast.LENGTH_SHORT).show();
                              }
                          } 
                          else if (resultCode == RESULT_CANCELED) 
                          {
                              Toast.makeText(getApplicationContext(), "Cancelled", Toast.LENGTH_SHORT).show();
                          }
                      } 
                      else if (requestCode == CAMERA_REQUEST) 
                      {
                          if (resultCode == RESULT_OK) 
                          {
                              if (intent.hasExtra("data"))
                              {                   
                                  // retrieve the bitmap from the intent
                                  Bitmap cameraBitmap = (Bitmap) intent.getExtras().get("data");
  
                                      String filePath = Environment.getExternalStorageDirectory()
                                  .getAbsolutePath()+"/TimeChat/image/"+System.currentTimeMillis()+".jpg";
  
                                  // update the image view with the bitmap
                                  imgCamera.setImageBitmap(cameraBitmap);
                              //  writeToFile(filePath, circleBitmap);
  
                              } 
                              else if (intent.getExtras() == null) {
  
                                  Toast.makeText(getApplicationContext(), "No extras to retrieve!", Toast.LENGTH_SHORT).show();
  
                                  BitmapDrawable thumbnail = new BitmapDrawable(getResources(), intent.getData().getPath());
  
                                  // update the image view with the newly created drawable
                                  imgCamera.setImageDrawable(thumbnail);
  
                              }
  
                          } 
                          else if (resultCode == RESULT_CANCELED) {
                              Toast.makeText(getApplicationContext(), "Cancelled", Toast.LENGTH_SHORT).show();
                          }
                      }
            }
           }
  
  
      @Override
      public void onBackPressed() {
          // TODO Auto-generated method stub
          super.onBackPressed();
          ProfilePhotoActivity.this.finish();
      }
  
  }
  </code></pre>