Thursday, October 6, 2011

Android Programming - Luas Bangun

I created (actually it based on someone tutorial and I modified it in some place, I can find the original link..) this very simple program to learn more about User Interface. How to layout, using Button, TextView and Edit Text. It is so simple, the function is to calculate the area of square, traingle and circle. User input the width, height or radius, and then the app calculate the area and show the result in a TextView.
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.





Categories: , , , ,

Related Posts:

  • Android Programming - Free EbookI'll upload some of my ebook collection to 4shared so you can download it. 1. I advice you to have a look at this Google IO 2010 presentation. It is simple but very good as a fundamental for beginning Android Application Deve… Read More
  • Android Programming - Free Ebook (2)1. Apress Android Essential - Chris Haseman Android is Google’s answer to the iPhone and at the very least, has advantages in terms of multitasking, running apps in the background and others. Google’s CEO is getting front … Read More
  • Android Article ListThis is my Android article list : Android Programming - Access Localhost Android Programming - Fast Way Preserving Sqlite Database Android Programming - Hello World Android Programming - ListView, ListActivity with Header A… Read More
  • Android Programming - Activity As already presented in earlier sections, Android application components can consist of 4 things, Activities, Services, Broadcast Receivers and Content Providers. For Activity itself has a cycle as shown above. So like i… Read More
  • Android Programming - Free Ebook (3)1. Wrox - Android Application Development - Reto Meier A hands-on guide to building mobile applications, Professional Android Application Development features concise and compelling examples that show you how… Read More

0 komentar:

Copyright © 2025 Johannes Dwi Cahyo | Powered by Blogger

Design by Anders Noren | Blogger Theme by NewBloggerThemes.com | BTheme.net      Up ↑