0

i have a FloatingActionButton in my layout:

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:onClick="capture"/>

And i want to upload an image from camera to Parse.com server when user clicked on this button.

EDIT :

I have found the answer :

Mahdi Nouri
  • 1,391
  • 14
  • 29
  • Possible duplicate of [How to capture image from custom CameraView in Android?](https://stackoverflow.com/questions/15391329/how-to-capture-image-from-custom-cameraview-in-android) – Mahdi Nouri Jun 27 '18 at 13:55

1 Answers1

2

For this workaround you need One camera that running on the background. on camera your all view will adjust. When you click on the FAB you call capture from camera and then you will get preview.

There are many example of custom camera and capture image from it.

Example for Camera

  1. http://www.c-sharpcorner.com/UploadFile/9e8439/how-to-make-a-custom-camera-ion-android/
  2. http://capycoding.blogspot.in/2012/06/custom-camera-application.html
  3. http://www.coderzheaven.com/2011/12/28/how-to-create-a-custom-layout-for-your-camera-in-android/

Now upload it on server.

NOTE:

  • this can leak your memory
  • you need to close camera when you finish. Otherwise your built in camera will tell user that camera not found.
Shabbir Dhangot
  • 8,954
  • 10
  • 58
  • 80