orikoko
orikoko

Reputation: 865

Open android camera application and use it as is

What is the way to open the build-in android camera application? I found a way to open a camera using intent, but using this way I have to save the pics by myself.

Thanks,

Upvotes: 0

Views: 73

Answers (1)

Robin Dijkhof
Robin Dijkhof

Reputation: 19278

Try this:

Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    try {
        PackageManager pm = mContext.getPackageManager();

        final ResolveInfo mInfo = pm.resolveActivity(i, 0);

        Intent intent = new Intent();
        intent.setComponent(new ComponentName(mInfo.activityInfo.packageName, mInfo.activityInfo.name));
        intent.setAction(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);

        startActivity(intent); 
    } catch (Exception e){ Log.i(TAG, "Unable to launch camera: " + e); }

Upvotes: 2

Related Questions