Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - onActivityResult not thrown with MediaStore.ACTION_IMAGE_CAP

onActivityResult not thrown with MediaStore.ACTION_IMAGE_CAP

All your problems with Audio, Video and Images.

onActivityResult not thrown with MediaStore.ACTION_IMAGE_CAP

Postby Steph » Tue Jun 14, 2011 8:35 pm

Hi everybody,

I 'm currently trying to get photo for my app but i have a problem. Photo is correctly save in my folder, but when camera app stopped it doesn't throw onActivityResult.
I really don't understand why.

If you have an idea, feel free to help me.

Thanks in advance.

(i have all the right in manifest)

Code: Select all
public void onClick(View v) {
      switch(v.getId())
      {
      case R.id.addPhoto:
         Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
         intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(getTempFile(this)) );
         startActivityForResult(intent, 100);//100 is code for photo
         break;
      }      
   }   

   private File getTempFile(Context context){
     //it will return /sdcard/image.tmp
     final File path = new File( Environment.getExternalStorageDirectory(), getString(R.string.app_name));
     if(!path.exists()){
       path.mkdir();
     }
     return new File(path, "image"+Math.random()+".bmp");
   }
   

   @Override
   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      if (resultCode == RESULT_OK) {
         switch(requestCode){
         case 100:
            final File file = getTempFile(this);
            try {
               Bitmap captureBmp = Media.getBitmap(getContentResolver(), Uri.fromFile(file) );
               _img.setImageBitmap(captureBmp);
            } catch (Exception e) {
               Log.e("s", "Add onActivityResult exception took photo",e);
         }
         break;
         default:
            super.onActivityResult(requestCode, resultCode, data);
            break;
       }
     }
   }
Steph
Experienced Developer
Experienced Developer
 
Posts: 90
Joined: Mon Oct 20, 2008 1:48 pm
Location: France

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 4 guests