Android camera for photo and video

I want to get started with the camera in my Android app, and I know how to do it. I want to ask when the action of the camera ends, how can I check how it was an image or video made by the user?

UPDATED

I have a dialog where it asks for 2 things.

  • New photo or video
  • Existing photos or videos

If not. 1, this means that the camera will be launched, and the user can either take a picture or a video, and he will return to activity.

If this is no.2, it means that the gallery will take pictures and videos for the user to select one and will return to activity.

+5
source share
1 answer

, Umair,               , , , , 1) 2) 3) /

: 1) 2) , , 1 3) ,

try{
   System.gc();
   String fileName = System.currentTimeMillis()+".jpg";
   String mPathImage = Environment.getExternalStorageDirectory()+ "/" + fileName;
   File file = new File(mPathImage);
   Uri outputFileUri = Uri.fromFile( file );
   Intent mIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
   mIntent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
   startActivityForResult(mIntent, 1);
   mValue=1;

} catch ( e) {

}

2, 2 & ; , .

try {
    System.gc();
    Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
    startActivityForResult(intent, 1);
    mValue=2;
}catch(Exception e){}

3- , 3 & ; , .

try{
   System.gc();
   Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
   intent.setType("*/*");
   startActivityForResult(intent,1);
   mValue=3;
}catch(Exception e){}
}

, , , , , /.

, .

+2

All Articles