综合技术

Open the Android Camera app

微信扫一扫,分享到朋友圈

Open the Android Camera app
0

I created a project with the theme "Navigation Drawer Activity" and I would like to have two options on the left menu :

  • Open the device camera to take pictures
  • Open the photo gallery

Here is a part of the code :

`

if (id == R.id.nav_camera) {
        // Handle the camera action
    } else if (id == R.id.nav_gallery) {

    } else if (id == R.id.nav_slideshow) {

    } else if (id == R.id.nav_manage) {

    } else if (id == R.id.nav_share) {

    } else if (id == R.id.nav_send) {

    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}

I tried several things but none of them opened the device camera.

Thank you !

For starting inbuilt camera

Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, PIC_CAPTURED);

For opening gallery to select picture

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
                  "Select Picture"), RESULT_LOAD_IMG);

阅读原文...


微信扫一扫,分享到朋友圈

Open the Android Camera app
0

Hello, buddy!

Websafe encoding of hashed string in nodejs

上一篇

文本自动摘要:基于TextRank的中文新闻摘要

下一篇

评论已经被关闭。

插入图片

热门分类

往期推荐

Open the Android Camera app

长按储存图像,分享给朋友