Android Camera App Tutorial – Create a Simple Camera App

Hello friends, so here is a new Android Camera App Tutorial. In this tutorial we will create a simple Android Camera App. So lets begin.

Creating Project for Android Camera App Tutorial

  • This is so simple open Android Studio and create a new project.
  • Now finish the things and you will get your MainActivity.
  • In this time we will try to make User Interface looks good.

Designing UI

  • I am creating a simple Button at the bottom of the activity. As you can see below.
android camera app tutorial
  • I have used font-awesome for the camera icon. So lets first learn how can you add font awesome to your android project.

Adding Font Awesome to Your Android Project

android camera app tutorial
Creating Assets

Creating Main Activity Layout

  • As you can see we have a single button at the bottom of our main activity.
  • Over the button we will see the image that would be captured with our app.
  • So we need an ImageView and a Button for this Android Camera App Tutorial’s main activity.
  • Go to activity_main.xml
  • And copy the following code

  • As you can see in Button tag I have defined a string. So go to your strings.xml file and add the following code

  • The initial value is the camera icon which I got from font awesome cheatsheet.
  • Now see the background property of our android button. I have given a drawable resource there. So Inside your drawable folder create a new xml file named button.xml
  • Add the following code inside that file.

  • Thats it for the layout part. Now lets move to the coding part.


  • Go to your file

  • We have declared instances for our button and imageview.
  • Lets initialize them first in our onCreate method.

  • Because we are using an external font we will need to set TypeFace for our button.

  • Now we will create a new method to open our camera.

  • We will call our open camera method on button click.
  • So add an onClickListener to your button.

  • Finally we will override the onActivityResult method to get the image.

  • The final code for would be

  • Now execute your project.
  • Because It is using camera so the device must have camera, or I recommend you to run in your mobile phone.
  • And yes you can download the source code for this android camera app tutorial from below.

[easy_media_download url=”″ text=”Download Source”]

So thats all for this Android Camera App Tutorial friends. In the next tutorials we will create some more complex camera applications on android. 🙂

14 thoughts on “Android Camera App Tutorial – Create a Simple Camera App”

  1. Hi Belal,

    I want to say a big thank you for creating this new series. A lot I see on youtube are very old from years ago, I particularly love how u are using Volley in your tutorials. Thanks for that. Please do you have Skype? Please do email me. I would like to speak about possiple 1-to-1 training.

    Thakms u so much.


    • Instead of uploading the image to mysql database upload the image to a drive and provide the link to database..this would reduce the transaction time with database……

  2. hi i have this error message
    Error:(5, 29) No resource found that matches the given name (at ‘drawable’ with value ‘@color/button_pressed’).
    can you help me please

    • hi
      I have also same error message

      Error:(5, 29) No resource found that matches the given name (at ‘drawable’ with value ‘@color/button_pressed’).
      can you help me please.. its urgent

      • I also have this issue:

        Cannot resolve symbol ‘@color/button_pressed’
        Cannot resolve symbol ‘@color/button_normal’

        Looks to be two problems:
        Under app/src/main/res/values I have an XML file called ‘colors.xml’, while the code you provided references a ‘color.xml’ file.
        Under my ‘colors.xml’ file, I only have colorPrimary, colorPrimaryDark, and colorAccent.

        Should we just define our own colors for ‘button_pressed’ and ‘button_normal’, or do you mean for us to do something else?


  3. Hi there, great tutorial had a good time reading it that is why I was wondering where are the other tutorials that you said on the last part. Would really appreciate it if you can send the link to where those other tutorials are 🙂 …again thank you so much for the help!!

  4. Dear Belal Khan,

    I tried your code in one of my mi lolipop and samsung phone with lolipop. Both working fine , but in my Lenovo lolipop mobile it shows “Unfortunately, Camera Example has been stopped”. Why this problem in this particular
    device. please advise a solution for same…


    Anes P A


Leave a Comment