capturePhoto - No Activity found to handle Intent

1,373 views
Skip to first unread message

Ioana

unread,
Apr 23, 2015, 5:42:57 AM4/23/15
to codenameone...@googlegroups.com
Hi,
I have a Button with a command that opens the camera

 private final class TakeSelfieCommand extends Command {
@Override
        public void actionPerformed(ActionEvent evt) {
            try {
                String value = Capture.capturePhoto(-1, - 1);
                if (value != null) {
                    ....

                }
           } catch (IOException ex) {
                Log.e(ex);
            }
}

and I received this bizarre crash from a user:

[EDT] 0:2:3,153 - android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE flg=0x4000000 (has extras) }
[EDT] 0:2:3,158 - android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE flg=0x4000000 (has extras) }
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1723)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1491)
        at android.app.Activity.startActivityForResult(Activity.java:3436)
        at android.app.Activity.startActivityForResult(Activity.java:3393)
        at com.codename1.impl.android.CodenameOneActivity.startActivityForResult(CodenameOneActivity.java:515)
        at com.codename1.impl.android.f.b(AndroidImplementation.java:4725)
        at com.codename1.aa.n.c(Display.java:3010)
        at com.codename1.d.a.a(Capture.java:68)
        at com.codename1.d.a.a(Capture.java:113)
        at de.infobest.mixnstyle.e$f.a(Mix.java:485)   // this is my line with: String value = Capture.capturePhoto(-1, - 1);


Do you know what the problem might be when user takes the pic?


Shai Almog

unread,
Apr 23, 2015, 10:52:51 AM4/23/15
to codenameone...@googlegroups.com
Hi,
on which device is this happening?
Is it possible the device doesn't have a camera?

Ioana

unread,
Apr 24, 2015, 5:52:26 AM4/24/15
to codenameone...@googlegroups.com
Hi,

I only know it's OS ver. 4.4.4.. This came from the crash reporting.

Shai Almog

unread,
Apr 24, 2015, 2:11:07 PM4/24/15
to codenameone...@googlegroups.com
Hi,
I'm guessing its because there is no camera. Use Display.hasCamera() to determine if the device has a camera.

Ioana

unread,
Apr 27, 2015, 6:58:32 AM4/27/15
to codenameone...@googlegroups.com
Hi,
Thank! I will do so!
Reply all
Reply to author
Forward
0 new messages