Search code examples
androidstoring-information

Put Information to a picture after Capture Android


Good day everyone.I want to put certain information on a picture which have been captured,for example from which location was it captured,in which angle,date of capture and etc.I heard of Id Columns inside android picture but not sure how i make that happen,can anyone please give me an example?

Here is a code how i capture a picture with x,y dimensions(like goggles crop)

Thread tGetPic = new Thread( new Runnable() {

                        public void run() {
                            Double[] ratio = getRatio();
                            int left = (int) (ratio[1]*(double)mView.getmLeftTopPosX());
                            // 0 is height
                            int top = (int) (ratio[0]*(double)mView.getmLeftTopPosY());

                            int right = (int)(ratio[1]*(double)mView.getmRightBottomPosX());

                            int bottom = (int)(ratio[0]*(double)mView.getmRightBottomPosY());

                            savePhoto(mPreview.getPic(left,top,right,bottom));
                            mAutoFocus = true;




                        } 
                    });
                    tGetPic.start();

Solution

  • After getting image you will receive the Intent. Do putExtra to this intent to add the info you want to. And use this in next activty or wherever you need the info.

    While calling camera, you call it as

    startActivityForResult(intent, REQUEST_CODE);
    

    and you have to override the method

    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    

    Where data is the intent with image. You need to add more info to this intent as follows.

    data.putExtra("imageId","12456");
    data.putExtra("location","paris");
    

    Also refer this link.

    http://developer.android.com/reference/android/provider/MediaStore.Images.ImageColumns.html

    Hope this helps.