title: startActivityForResult is not working in Fragment
body: <p>I am currently working with with Fragment. I want to  pick Image from gallery &amp; display it onTo fragment class. But here startActivityForResult() is not working in Fragment.</p>
  
  <p>My fragment class</p>
  
  <pre><code>Button loadimage=(Button) view.findViewById(R.id.loadButton);
      loadimage.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
              Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
               startActivityForResult(i, RESULT_LOAD_IMAGE);
          }
      });
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) {
          Uri selectedImage = data.getData();
          String[] filePathColumn = { MediaStore.Images.Media.DATA };
  
          Cursor cursor = getActivity().getContentResolver().query(selectedImage,
                  filePathColumn, null, null, null);
          cursor.moveToFirst();
  
          int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
          String picturePath = cursor.getString(columnIndex);
          cursor.close();
          imgview.setImageBitmap(BitmapFactory.decodeFile(picturePath));
  
      }
  
      }
  </code></pre>