Creating the mobile app

Ok, if you came this far, it means that mobile app is already a serious topic for you. Creating a mobile app in Android Studio has nothing to do in terms of difficulty compared to designing it in App Inventor 2 or Apache Cordova.

So we are going to be very careful here and are going to really do things step by step.

Setting the app in landscape mode

Ok, I personally did not have a clue about how to do this at the beginning. So I found this post: https://stackoverflow.com/questions/8408197/android-landscape-only-orientation

and then figured out that I needed to add:

android:screenOrientation="landscape"

within the activity tag of the manifest file.

You can directly double-check it by launching an emulator and see if now the app is in a landscape mode. If you end up with something like this, you can have your first coffee break:

Add the title tag

Ok, nothing very difficult here neither, we are just going to change the word Hello World by our sentence and we are going to make the fonts size bigger.

Start by putting the UI display in landscape mode:

Ok so by clicking the Hello World text, you can clearly identify that you can change its attributes, just play a bit with those and you should end up with something similar to this:

Removing the status bar

Once more, I had no clue about how to do this, so I looked on the internet and found this: https://stackoverflow.com/questions/46397213/how-can-i-remove-the-status-bar-in-android-studio-activity-preview/46397248 so just hover your mouse at this location and you will be able to access to themes, where you will be able to set it to Light.NoTitleBar.FullScreen:

Ok great, now let's see how to add the buttons.

Adding the buttons

Adding buttons make me berserk at the beginning because once dropped on your app, Android Studio starts to tell you that you are not inserting at the right location. In order to fix that, select the button and then play with the layout:


Adding the images

Once more, I had no clue, about how to do that. In fact, the main thing you have to know is that you need to copy and paste your images within a folder of your Android app. In my case it is: /home/user/AndroidStudioProjects/Satisfaction/app/src/main/res, once done you will see that those images will appear within your Android Studio project:

Once you have done this, you need to set those pictures to the background image of each button:

and this is done for the pictures part and done also for this screen.

Add the results screen

Ok so, now, we need to tell Android that every time someone will click on any of those buttons, they will be redirected to a new screen.

So let's start by creating a new screen. In order to do so, we need to create a new activity, so right click on your project and create a new empty Activity that you will name Results:

Once the activity created, it is kind of easy to add a text view component and insert the message we want there:


Linking the home screen to the results screen when clicking on the buttons

Ok so now we have two screens, it is interesting but we need to link one with the other. This is where we will need to code a bit.

The magic will happen within the main Java file. https://www.youtube.com/watch?v=GtxVILjLcw8

Last modified: Sunday, 1 December 2019, 8:04 PM