Hi which method r u using 2 call the camera using intent i.e.,
startActivity or StartActivityforResult(intent,
REQUEST_CODE_TAKE_IMAGE);

so use 2nd function it ll calls onactivityresult if it captures the
image.

On Dec 12 2011, 9:52 am, SH <[email protected]> wrote:
> Hi all.
>
> I have an app and fixing errors/bugs. But I have problem when
> NewPictureNote.java calls PhotoTaker.java using
> startActivityForResult() to take a photo and save. My code uses
> callback and put binary data into Intent to return to previous
> activity. Here is the code:
>
> //PhotoTaker.java
> public class PhotoTaker extends BetterDefaultActivity implements
> SurfaceHolder.Callback{
>
> //......
>
>    public void clickHandler(view v){
>         //.....
>         Intent returningIntent = new Intent();
>         returningIntent.putExtra(EXTRA_IMAGE_DATA, jpegPictureData);
>         setResult(RESULT_OK,returningIntent);
>         finish();
>         break;
>     }
>
> }
>
> //NewPictureNote.java
> public class NewPictureNote extends BetterDefaultActivity {
> //....
>
> protected void onActivityResult(int requestCode, int resultCode,
> Intent data) {
>                 super.onActivityResult(requestCode, resultCode, data);
>
> try
>                 {
>                         //If we are getting a response from our picture 
> taking activity
>                         if(requestCode ==REQUEST_CODE_TAKE_IMAGE)
>                         {
>                                 //If it was successful
>                                 if(resultCode == Activity.RESULT_OK)
>                                 {
>                                         //do something
>                                 }
>                                 else
>                                 {
>                                         //The user cancelled or an error 
> occured
>                                         setResult(Activity.RESULT_CANCELED);
>                                         finish();
>                                 }
>                         } else {
>                               //...
>                         }
>                 }
>                 catch (Throwable e) {
>                       //...
>                 }
>
> }
>
> When I debug code, clickHandler() method in  PhotoTaker.java works
> well. It calls till the end of the clickHanlder() but the Activity
> won't close and onActivityResult() does not work. Please let me know
> what problem is? Thanks in advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to