Capture picture from camera - Android Studio Tutorial

  Рет қаралды 57,791

The Code City

The Code City

Күн бұрын

If this helped, consider buying me a coffee:
BuyMeACoffee: buymeacoffee.com/thecodecity
BTC: 18aykL2WcZX8S1BCheV85JJgPQWWXoPvAS
ETH: 0xe3bb3c3650a084e1229a8574d9f611c01d3b847f
RVN: RLNRybTC8TzqoxWC65mrK4yF4BRPZFarzY
ZEC: t1YU7XLWVfA7uMQdRWknZ37rxvJ72xcL4uL
In this tutorial, we create an Android app that takes picture from the Camera and displays it in an ImageView. The steps involved are:
1. Create a layout with button to open Android Camera
2. Create main activity and ask for permission to use camera and write to external storage.
3. Create a FileProvider
4. Create an Intent with ACTION_CAPTURE
5. Get the Bitmap in onActivityResult and display the Image in ImageView
This is a comprehensive tutorial that shows you how you can take pictures using the Camera in your Android app and how you can save it to local storage.
TheCodeCity Website: www.thecodecity.com
~-~~-~~~-~~-~
You can check how to upload taken image here:
• Upload Image to Server...
~-~~-~~~-~~-~
Social Media:
thecodecity
thecodecity
thecodecity

Пікірлер: 113
@danielarodriguez1967
@danielarodriguez1967 5 жыл бұрын
Thank you! Great video! I really like that you left the errors in, helped a lot.
@hentaipie8403
@hentaipie8403 5 жыл бұрын
after ten hours internet search,finally achieve the function in your viedeo,you are so great!!! thanks a lot
@1202blong
@1202blong 5 жыл бұрын
Dude, you are awesome man!! Really appreciate your work and video!
@TheCodeCity
@TheCodeCity 5 жыл бұрын
Thank you! :)
@chelseakatsidzira7153
@chelseakatsidzira7153 5 жыл бұрын
thanks for taking the time to make this video. i can see the font just fine. really appreciate it!
@TheCodeCity
@TheCodeCity 5 жыл бұрын
You're welcome. I'm glad it helped you. :)
@kirankumar0707
@kirankumar0707 4 жыл бұрын
It worked perfectly on the first installation. The best explanation I saw until now.
@novajaylen5296
@novajaylen5296 3 жыл бұрын
i guess Im kind of off topic but does anyone know a good place to watch newly released movies online ?
@leolouie9549
@leolouie9549 3 жыл бұрын
@Nova Jaylen Flixportal :D
@novajaylen5296
@novajaylen5296 3 жыл бұрын
@Leo Louie thanks, signed up and it seems like a nice service :) I appreciate it!!
@leolouie9549
@leolouie9549 3 жыл бұрын
@Nova Jaylen no problem =)
@neelukalani43
@neelukalani43 5 жыл бұрын
Worked perfectly in one try. Great work. Thanks for the tutorial. :)
@TheCodeCity
@TheCodeCity 5 жыл бұрын
You're welcome. I'm glad it helped you. :)
@scienceblock
@scienceblock 5 жыл бұрын
really useful video, thanks!!!
@OmarKhaled-dw7oi
@OmarKhaled-dw7oi 4 жыл бұрын
Thank you so much mate, Much appreciated
@swatishrestha2855
@swatishrestha2855 4 жыл бұрын
Great job loved the explanation ❤️
@frankgalvez9757
@frankgalvez9757 5 жыл бұрын
Works like a charm!
@computerscientist6691
@computerscientist6691 4 жыл бұрын
Hello a few small things needed some changes but after all it works perfectly, thank you for this great tutorial.
@phenom2586
@phenom2586 5 жыл бұрын
Thanks dude! this one saves my degree!
@Darkj4
@Darkj4 4 жыл бұрын
Te ganaste un like compadre ! :D you are the best !
@prajktarajedeshmukh7495
@prajktarajedeshmukh7495 4 жыл бұрын
Thank you for your help.
@bambooartchannel891
@bambooartchannel891 5 жыл бұрын
Thank you. How I can pass picture from picture to another activity ? (I take a picture click okay and I want pass picture to another activity).
@swiftstartechnology3213
@swiftstartechnology3213 4 жыл бұрын
great vid!!!
@bijinraju1969
@bijinraju1969 4 жыл бұрын
Thanks For The Guidance
@srinivasaeranki2778
@srinivasaeranki2778 5 жыл бұрын
How did you make it so that it gives you the option to choose from existing images or to take a picture on your camera immediately? When I try it, it doesn't give me the option but rather, just goes straight to camera. Amazing tutorial by the way.
@ilhamriana7687
@ilhamriana7687 4 жыл бұрын
Nice, keep it up!
@TheCodeCity
@TheCodeCity 4 жыл бұрын
You're welcome :)
@richardsonalex6284
@richardsonalex6284 5 жыл бұрын
How to connect a DSLR camera ? You have any idea
@RohitKumar-nk2xl
@RohitKumar-nk2xl 3 жыл бұрын
How to compress image before uploading to server if I m fetching image thy fileprovider in Android
@Artupaws
@Artupaws 5 жыл бұрын
Thank you so much
@TheCodeCity
@TheCodeCity 5 жыл бұрын
You're welcome :)
@miguelfonseca7580
@miguelfonseca7580 5 жыл бұрын
thank you
@coldworld3102
@coldworld3102 4 жыл бұрын
can you post a tut to zoom into the camera photo?
@Steelifyful
@Steelifyful 4 жыл бұрын
Hi! I'm running the app on Nexus 4 with API 25. Could someone tell me where the picture will be stored? I can't find it anywhere
@indianmaza9762
@indianmaza9762 4 жыл бұрын
Hi, you can find your answer there 👇 kzfaq.info/get/bejne/gruRnMtpudu6Y5c.html
@hustlas4ever
@hustlas4ever 5 жыл бұрын
HI! I have a problem. My image file size is 0 byte. Do you have idea for this?
@gabriellgardin
@gabriellgardin 4 жыл бұрын
Mine too
@basketberoende
@basketberoende 4 жыл бұрын
I get error at the provider tag in the manifest. "unresolved class"= i cant fix it... any tip?
@indianmaza9762
@indianmaza9762 4 жыл бұрын
You can find your answer there 👇 kzfaq.info/get/bejne/gruRnMtpudu6Y5c.html
@Praveenkumar-pe6fh
@Praveenkumar-pe6fh 3 жыл бұрын
Great video. It would be helpful if you had uploaded a code file in the description.
@blueguy5588
@blueguy5588 4 жыл бұрын
You sound like pewdiepie at 21:30. Great video btw.
@starzandearth
@starzandearth 5 жыл бұрын
How do u make an app that takes a photo and then takes that photo and emails it to someone as an attachment directly?
@blockbusterlatefees7713
@blockbusterlatefees7713 5 жыл бұрын
That would be a great tutorial :D
@mitechnologies2451
@mitechnologies2451 4 жыл бұрын
all are working nicely sir.. but can not find picture in gallery ..when take image also loading to image view ..after should save in my phne memory ..but can not see ? plz help me
@hunterpuppycrazy5776
@hunterpuppycrazy5776 5 жыл бұрын
camera is not opening...plz help me
@antrashrey6049
@antrashrey6049 4 жыл бұрын
is it possible to capture an image without opening camera intent? just with the button click.
@TheCodeCity
@TheCodeCity 4 жыл бұрын
No it's not
@merahnacera5817
@merahnacera5817 4 жыл бұрын
hi! i have a problème in return image; can you help me
@indianmaza9762
@indianmaza9762 4 жыл бұрын
Hi,you can find your answer there 👇 kzfaq.info/get/bejne/gruRnMtpudu6Y5c.html
@benslimanemohammed8121
@benslimanemohammed8121 4 жыл бұрын
thanks
@tehilaschechter2230
@tehilaschechter2230 4 жыл бұрын
Can you post the source code for this?
@TheCodeCity
@TheCodeCity 4 жыл бұрын
Sorry, don't have source code at the moment. Will include it from the next tutorials.
@student9297
@student9297 4 жыл бұрын
@@TheCodeCity ?
@mire_cs
@mire_cs 3 жыл бұрын
idk how you heard the difference in volume between intro music and your voice in the video and thought "yeah, this sounds great"
@TheCodeCity
@TheCodeCity 3 жыл бұрын
Everybody hurts... 😢
@samirshrestha5252
@samirshrestha5252 4 жыл бұрын
Dude, I stuck on problem, when image is captured, image is save inside app but it is not loaded on image view, and not showed in gallery. need help in onActivityResult, data is null
@TheCodeCity
@TheCodeCity 4 жыл бұрын
Which Android version?
@nabilzulkefli6094
@nabilzulkefli6094 5 жыл бұрын
Can you upload a better video resolution ? I can't really see your code
@TheCodeCity
@TheCodeCity 5 жыл бұрын
Please watch the video in 720p or 1080p
@lanaparezanin8525
@lanaparezanin8525 4 жыл бұрын
This tutorial is AMAZING, thank you soooooo much! I have a question - how exactly is this picture saved in the app? If I wanted to access it in the next slide for example, how would I call it?
@TheCodeCity
@TheCodeCity 4 жыл бұрын
It's saved in the local storage of the phone. You can get the photo from there.
@student9297
@student9297 4 жыл бұрын
@@TheCodeCity what is the authority text in dispatchpicture method?
@imanmanz
@imanmanz 5 жыл бұрын
why the image view is not work? i only can take the picture but cannot display it
@Kevin-saputra9820
@Kevin-saputra9820 5 жыл бұрын
me too
@user-zw6hg6hy2w
@user-zw6hg6hy2w 4 жыл бұрын
sa
@mindflayer99
@mindflayer99 5 жыл бұрын
it is showing error unfortunately camera app has stopped
@indianmaza9762
@indianmaza9762 4 жыл бұрын
Hi, you can find your answer there 👇 kzfaq.info/get/bejne/gruRnMtpudu6Y5c.html
@mconrey9705
@mconrey9705 4 жыл бұрын
nice video,but only can store image once, when I press button and repeat the procedure, I can't find picture just be captured. how to solve it?
@mconrey9705
@mconrey9705 4 жыл бұрын
Oh it work, need exit Photos app, and reenter it.
@Sposhal
@Sposhal 5 жыл бұрын
Sir it shows me error "Unfortunately stop" how to fix it i use android 5.1 version android phone..
@hetalpatel9524
@hetalpatel9524 4 жыл бұрын
i also have this problem if you solved this plz tell me how to solve
@indianmaza9762
@indianmaza9762 4 жыл бұрын
Hi, you can find your answer there 👇 kzfaq.info/get/bejne/gruRnMtpudu6Y5c.html
@rahulpowar8811
@rahulpowar8811 5 жыл бұрын
Nice tutorial. Can you tell me how to store image in SQLite after click. If you have any video in this topic please suggest. Thanks for this tutorial.
@TheCodeCity
@TheCodeCity 5 жыл бұрын
You shouldn't not save images in database. You need to save the image in app's private directory and save the image name in Database. If you want to save the image in DB then first convert image to base64 format then save it.
@skypointvn
@skypointvn 5 жыл бұрын
Font Size is too small!
@swiftstartechnology3213
@swiftstartechnology3213 4 жыл бұрын
Hi thanks for the vid....can anyone send me a link with the code?
@blockbusterlatefees7713
@blockbusterlatefees7713 5 жыл бұрын
The next best tutorial would be how to send the image to a server for example, that would be cool!
@TheCodeCity
@TheCodeCity 5 жыл бұрын
Got it! will do :D
@khaanpin
@khaanpin 4 жыл бұрын
It's here now: kzfaq.info/get/bejne/l9aJa9l0ybiweKc.html
@vijayalakshmimannay4716
@vijayalakshmimannay4716 5 жыл бұрын
Really nice tutorial..It worked on first attempt..but fontsize is too small,except that appreciate for your work..please try to make a video on stored that every captured image uploaded to database.
@TheCodeCity
@TheCodeCity 5 жыл бұрын
Sure, will do :)
@vijayalakshmimannay4716
@vijayalakshmimannay4716 5 жыл бұрын
ok :)
@rahularora1079
@rahularora1079 5 жыл бұрын
Can you send me the code for.. Capture image nd upload to database also.. Please reply asap..
@TheCodeCity
@TheCodeCity 5 жыл бұрын
Sorry, the code is not available.
@agungwpg
@agungwpg 5 жыл бұрын
dude, how to make a new directory in Pictures dir and then store our files there...
@TheCodeCity
@TheCodeCity 5 жыл бұрын
Just get the path to Pictures directory and create new Directory in it using mkdir or mkdirs then save your photo in that directory.
@agungwpg
@agungwpg 5 жыл бұрын
well thanks bruh @@TheCodeCity
@TheCodeCity
@TheCodeCity 5 жыл бұрын
@@agungwpg My Pleasure
@migaspt5676
@migaspt5676 5 жыл бұрын
@@TheCodeCity I managed to create a new directory inside Pictures and save it there, but it still saves an empty file with the same name in Pictures. How can I change that, based on your code?
@migaspt5676
@migaspt5676 5 жыл бұрын
Nevermind, calling delete() after startActivityForResult did the trick.
@turyakiravitari9245
@turyakiravitari9245 5 жыл бұрын
u have work .dia
@VikasSharma-ud4vj
@VikasSharma-ud4vj 5 жыл бұрын
Please share code thanks
@TheCodeCity
@TheCodeCity 5 жыл бұрын
It will be uploaded soon
@swiftstartechnology3213
@swiftstartechnology3213 4 жыл бұрын
@@TheCodeCity hi there...may I have a link to the code please?
@mustafaazyoksul1372
@mustafaazyoksul1372 5 жыл бұрын
give the source code please
@swiftstartechnology3213
@swiftstartechnology3213 4 жыл бұрын
hi did you get the code?
@mikaelkolehmainen9098
@mikaelkolehmainen9098 5 жыл бұрын
It didn't work for me
@computerscientist6691
@computerscientist6691 4 жыл бұрын
hi, do you know where is problem? open log and tell us?
@rudeadyet1992
@rudeadyet1992 4 жыл бұрын
you from nepal bro?
@TheCodeCity
@TheCodeCity 4 жыл бұрын
Yes :)
@rudeadyet1992
@rudeadyet1992 4 жыл бұрын
Nice tut man!!
@sagal.h.462
@sagal.h.462 4 жыл бұрын
Too low volyme
@FarhanKhan-cp2kw
@FarhanKhan-cp2kw 5 жыл бұрын
please please please improve sound quality
@alikghosh2203
@alikghosh2203 4 жыл бұрын
next time please speak loudly
@jethrobodeen7794
@jethrobodeen7794 5 жыл бұрын
Please go a LOT slower, and speak a LOT louder.
@TheCodeCity
@TheCodeCity 5 жыл бұрын
Will try be slower from the next tutorials. Thank you for the feedback 🙂
@jethrobodeen7794
@jethrobodeen7794 5 жыл бұрын
Well, the app doesn't work. Perhaps you're using an older version of something. Thanks for trying.
Reduce Image Size for Upload | Android Tutorial
11:22
The Code City
Рет қаралды 22 М.
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 15 МЛН
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 207 МЛН
Задержи дыхание дольше всех!
00:42
Аришнев
Рет қаралды 3,8 МЛН
Create a FileProvider to store an image on Android
8:22
Brandan Jones
Рет қаралды 6 М.
Android capture image from Camera and select image from Gallery
28:35
Wintech Tutorials
Рет қаралды 89 М.
Android Studio Tutorial (2021 Edition) - Part 2
9:15
DJ Malone
Рет қаралды 230 М.
Pick an Image from the Gallery - Android Studio - Java
11:06
Atif Pervaiz
Рет қаралды 60 М.
Document Scanner & Crop using Android Studio Tutorial Part 2
7:21
Android with Haroon
Рет қаралды 20 М.
Build A Simple Android App With Kotlin
1:11:41
Traversy Media
Рет қаралды 928 М.
Create a Simple Camera App Using Android CameraX (Kotlin)
25:41
Isaias Cuvula
Рет қаралды 38 М.
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 15 МЛН