meta data for this page
  •  

This is an old revision of the document!


Android basics

First thing to do before starting making your android program is plan. here things you need to know before you start coding anything:

  • What your program is. Is it calculator or game or what?
  • what functionality it needs. does it play sound, does it need acceleration or fancy graphics
  • how to divide it in functional different classes and does it use patterns. Notice MVC pattern is good for games
  • decide does it need many Activities or views and if so how they communicate and are related
  • now calculated time needed and multiply whit pi. if it takes too much reduce functionality.
  • find core functionality and bare basic that are needed and implement them
  • if time was let from previous one, implement all rest fancy stuff you planed originaly

Layouts

When building Gui it is important to choose right layout. while using linear layouts is easy they are very restrictive. Relative in other hand is way to get complicated designs but need often small changes to xml. I suggest to use Realative Layout as default. Things that you find your self adding by hand to xml are.

  • android:layout_centerHorizontal=“true”
  • android:layout_centerVertical=“true”

to get element centered

  • android:onClick=“onSaveButtonClick”

to add click listening to buttons,togglebuttos and pretty much everything

links:

Icons and resources

your android project has resources in res folder. you can add resources by manually editing files in case of res/values/strings that is rather suitable and easy

Links:

AndroidManifest.xml

often manifest file is missing your brand new Activity or you haven't set permissions there, So keep close eye on this file as it causes you lots of problems if you don't

links:

If your project stops building suddenly

run in eclipse menu project/clean. If that doesn't help check next files that there aren't some trash in them. This can happen whit automatic code generation for older android versions. avoid those automatic generations and code your code other way so you don't need to use them as they will destroy your project some times.

  • project.properties
  • proguard-propertise.txt
  • AndroidManifest.xml
  • and check resource files