开发者

problem in using camera in android

开发者 https://www.devze.com 2023-02-24 17:14 出处:网络
following is the code by which i am capturing images in my app. After capturing the image it saves it in SDcard and shows done and retake when i click the done button i want the captured image to be u

following is the code by which i am capturing images in my app. After capturing the image it saves it in SDcard and shows done and retake when i click the done button i want the captured image to be uploaded to an url.

i am not able to know from where the done and retake button gets appeared pls help me...

protected static final int TAKE_RECEIPT = 0;
Button b1;
    Intent myIntent;

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        b1 = (Button)findViewById(R.id.widget98);

        b1.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                takePictureFromCamera();
            }

            private void takePictureFromCamera() 
            {
                 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
 startActivityForResult(intent, TA开发者_JAVA技巧KE_RECEIPT);
            }


To save the image somewhere specific, you need to provide the Uri using MediaStore.EXTRA_OUTPUT:

mIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(filename)));

The done and retake buttons are shown as part of the MediaStore.ACTION_IMAGE_CAPTURE intent that you call. You cannot change that.


The "OK"/"Retake" buttons are shown on the so called "post-capture alert" UI which is part of the Camera application (check /packages/apps/Camera/src/com/android/camera/Camera.java if you have the Android source code downloaded), and I'm afraid there is no way to get rid of them.

0

精彩评论

暂无评论...
验证码 换一张
取 消