Science Quiz Android Application
Now that we are well versed with Activity, Layout, Views etc its time to get our hands dirty, and create our second application. This application will have a science quiz, and user will have option to answer in True or False. Based on what the user enters, we will show the user, whether they selected the correct option or not by simply showing a message saying Correct or Incorrect.
ScienceQuiz Application Development
- Open Android Studio and go to File → New → New Project. In the New Project window, enter the Application Name as
ScienceQuiz and company domain as
com.studytonight.quiz and Click on Next.
- In the next step you will be asked to select the targeted device, on which your application will be supported. Let's stick with
Phone and Tablet for this application. And in the dropdown saying Minimum SDK choose
API 16: Android 4.1 (Jelly Bean), this means our App will work on all the Phones and Tablets with Android Version 4.1 till 7(the latest version). Click on Next button.
- Now its time to add the first Activity to our application. Select the
Empty Activity from the avilable options. And click on Next.
- Enter the activity name to be
ScienceActivity, and Android Studio will automatically fill the layout file name. It is a standard practice to add suffix Activity in the Activity names and we will follow it. And for layout XML file, it is all words in small and in reverse order, separated by underscore
_. Click on Finish to create the project.
- Android Studio will take some time, to build everything, so be a little patient. Once Android Studio finished building your project, you will see a new project added to the left project tool window, the
activity_science.xml file will be open and in the Preview tool window you will see the preview for your app. If the Preview tool window in not open, go to View → Tool Windows → Preview, and the preview window will show up on the right side.