free
web stats

Android – How to Develop Simple Coin Flip Application

Android – How to Develop Simple Coin Flip Application

In this post we will learn how to we make coin flip application in android.

Firstly create new android empty project like this;

We need two images which are coin heads and tails. You can download from google as write coin heads and tails.

Then go to activity_main.xml file. We are going to design our view page.

I’m adding one ImageView and one Button and setting imageView’s src with heads.png file. Here is activity_main.xml file codes;

activity_main.xml

Then go to MainActivity.java file. Firstly we are creating button and imageview properties. Then set these properties with our view elements.

Now write btnFlipCoin’s setOnClickListener method and this code;

MainActivity.java

AndroidManifest.xml file codes;

Then result 🙂

 

You may also like...

Leave a Reply

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