Check out the source code in my GitHub. Here is the link.
1. As ussual create new project, I named it Luas Bangun, with LuasBangunActivity as a main activity.
2. Prepare AndroidManifest, create 3 new Activity from there, named it HitungLingkaran (for circle), HitungSegitiga (for triangle) and HitungPersegiPanjang (for square).
3. Let's begin templating. First create layout for LuasBangunActivity. It is in the main.xml file. You need to create three other XML file, one for each, lingkaran.xml (circle area), persegipanjang.xml (square area) and segitiga.xml (triangle area).
4. And then code the MainActivity. It is used for main screen, giving a link to another activity and exiting from application.
5. The lingkaran, persegipanjang and segitiga do not have any difference in programming structure, it is same, the difference is just the algorithm to calculate the area, and I think it will be easy, you know it from since elementary school.
6. Run your application, hope you found no error and I hope this example will help you a little to understand basic of User Interface in Android.
0 komentar:
Post a Comment