Home Coding Building Apps Building a Simple Android Facts App

Building a Simple Android Facts App

0

facts-tutorial

Today we will take you through the basic stuff when building apps in Android Studio. The idea is to construct a simple app that will bring up facts when the user touches a button. This is meant to be an introduction to Android and we’ll juggle with basic concepts. The end game here is to give you an idea of how app development is done and urge you to start building your own projects.

Steps on Building a Simple App using Android Studio

1. Start a New Android Studio project and name your application along with the company domain. Leave the default minimum SDK and add an Empty Activity to get us started. Rename the activity and click Finish.

12

2. You should have content_fun_facts.xml already open, but, if not, you can open it from res>layout. Switch to Design and click on the “Hello World!” text. With the text selected scroll down on the properties tab until you find the text attribute. Change that to “Did you Know?”

3

3. Drag a new Plain TextView from the Widgets section, center it vertically and align it with the left edge.

4

4. Change the newly created Text  to our first fact like “If you lift a kangaroo’s tail off the ground it can’t hop.” Enlarge both TextViews by adding value to TextSize attribute, something around 24sp.

5

5. Let’s add a Button and center it on the bottom side of the screen. Change the text property to Show Another Fact.

6. Change the RelativeLayout background to a greenish color. I used color code #51b46d. Let’s also change textView text color property to white.

6

7. Change the transparency of Textview2 by opening the colors tab and changing the Alpha value to 128.

7

8. Adjust the padding by changing the code in res>values>dimens.xml to:

9. Go to res>values>styles.xml and insert the following code:

10. Open FunFactsActivity.java and insert the following code:

11. Right Click on the Package name>New>Java Class and name it FactBook.

8

12. Insert the following code into FactBook:

13. The app should be ready now! If done properly, it should display as the screenshots below.

91011

Denis Madroane App junkie, Android developer, proud Freelancer. Passionate about app development and blogging, updated with the new stuff. Likes to think that he's versed in app re-skinning, content writing and social media.

LEAVE YOUR COMMENT

Your email address will not be published. Required fields are marked *

Powered by WordPress