Thursday, September 2, 2010

Android Development Tutorial/Overview - with sample code.

Android Development/Programming:
The basic concept of android is JFX(or JSP) like development of UI in java. You should know that android testing using emulator is very slow (unless you do it on an actual device eg droid incredible)- and unlike iphone you can freely deploy your apps on your phone. Android (like java permission file or vista/widows 7 model) like to warn before installing application - and applications have to indicate what kind of permission it needs.

Before starting Android development - you should know java first - by reading books like Core java (other programming back ground is useful) etc

Getting Started:
You should get started using : (or androids website).

Other links:

With android - you have to develop java program like in 90s(but at least its still java) :

You can access unix shell (eg adb shell) and analyze memory from this tutorial:


Open GL ES

Android uses Open GL ES(subset of Open Gl for mobile ) for game development- just like Iphone.
 Its however tough to find good books or a good tutorial on Open Gl Es for android.

Android Game video tutorial:

Android 3D game tutorial,312.html

Making games on Android

Getting started Link -in games -

OpenGlEs for Iphone(similar to OpenGl Es on Android)

Opengl(not openGles) redbook


Android Books :

a) General Ones: 
This a tough one(as they are moderate quality or will easily get outdated).
However top books seems to be :
Professional Android 2 application development (This one covers most topics-  but does not explain in detail)

Pro Android 2 ( This one is similar to above book.. But I dont like reading on the cheap - yellow paperback pages provided by apress . This book was hard for me to get online - but i could preview it at barnes and nobles store - and it seemed verbose to me. )

The above two books covers the most topics - and may be your best bet now(yet- june 2010).. However there style is not good(verbose, making book huge with code/examples without clearly explaining them)
(The Unlocking Android seemed promising to me - but was outdated.  The Hello, Android may be promising. I however liked the tutorial style(not content) of the heavily criticized book - Android Application Development: Programming with the Google SDK )
I have however chosen to download pdf books from which provided good content for the price - but its not a replacement for having physical book in your hand.(This site however did not post to https by default- and had no facility to change password)

b) Game Books:
There are insufficient material on developing games. But here you go:
Pro Android Games  (its useful - only if you already know open gl and c++)
Beginning Android Games (not yet released)

You may need to buy books to brush your maths (but first try some games and see if you get around by googling)
 3D Math Primer for Graphics and Game Development (Wordware Game Math Library)

Mathematics for 3D Game Programming & Computer Graphics (Game Development Series (Charles River Media).)

Running google Samples:
Once you have got your eclipse setup . The next step is to run google samples(that you downloaded with sdk).
If you are developing games - then googles snake example is a good one to start.

If you have a sample android project (new android project) in eclipse  then - Copy googles sample
code for Snake into your project - and then remove main.xml from res/layout.
(or preferably use New Android Project ->Create project from existing sources)

You should now be able to run it on your device(like incredible) or emulator..
For me the emulator took to much time and I gave up. On incredible it ran OK on second
attempt(after doing force crash on first).
While running it - it displayed a confusing message that I need to press on some "up button".
to start playing. I quickly realized that they meant - that i need to move the track ball up.(I hardly use the
weird track ball in droid incredible)

NOTE: If your PC (or maybe phone) is sleeping then this device may go offline.
Hence you may get below error:

[2010-06-03 13:06:23 - Demo ] device (HT0DEVICE) request rejected: device offline
To fix this just kill adb.exe (From task manager)  or try restarting eclipse.

MY FIRST SAMPLE CODE on Android(droid incredible):
I looked at googles sample code for Text To speech. It was too much details for a sample . Hence I used it to write my own sample. The full code of my Text to speech sample code is here:

Deploying on HTC droid incredible :
The current google sdk(2.1 version 7) does not have incredible settings in its
USB configuration file. Hence when you connect your computer to charge it.
It may say that "ADB" could not be installed. Without it - you will not
be able to see - droid incredible - in target devices in eclipse(or adb devices will
not show anything).
I followed instructions on :
It did work on one of my xp machine(but strangely I could not make
it work on another XP machine.. maybe due to jdk or driver corruption).. Be careful
- in trying USB debugger to fix this(as my antivirus says that most of them have virus)

Running on droid incredible device :
After the ADB was installed- I just created default android project .
I then ran it - and it automatically chose my htc as target(as i did not set up any other emulator devices) . It also automatically installed in my device(with android market icon). I was pleasantly surprised that it ran immediately!(ie did not take forever to load/run  - unlike when you run with emulator. It may make sense to directly
test on device.
Debugging Issue: However - i made some mistake when I tried to run TextToSpeech sample provided by google sdk(after I edited it).. It did not give any good error message . All it said on the device was that - I need to press button to forcibly close the application.  Luckily - I knew the changes I made and i removed it.(it was perfectly compile application - but i had added some color stuff). Hence I would recommend that you do development in  small steps - else you wont know - why your stuff is failing.

Other notes:
  • There is no api to send automated email(you can just open email window).
However strangely there is api to send automated SMS(which can cost money
and abused by virus) For sending email you may have to use (huge size) - ported version of javamail(as javamail is dependent on awt).

  • There is facility in the api to "place phone call" . But I could not find anyway to hook - my text to speech sample into it.(ie can not leave automated telephony message)

        This will also allow you to delegate UI updates to be controlled on server.(as most users will not update apps). This is a good approach for many apps. The security etc are being handled by traditional mechanism.
  • Once you install sdk - you can use ddms.bat from tools directory - > Choose a device -> and do device capture to do screen shots of stuff in your phone.
  • If you want to develop cross mobile OS apps - and using HTML/JS then you may consider Titanium Appcelerator or PhoneGap
(initial impression is that Titanium is more focussed on IPhone/Android . But PhoneGap which provides little framework is truly more portable)

Other related Blog:
You may click on my blog - for steps/tips on creating mobile website for android,iphone. (as not many users will like
to download apps - as they can use alarms/services to impact battery life)

You can click this : choose android phone/usage/tips link to learn(or go back) more about deciding on how to choose best android phone. (developers should prefer  phone that is easily rootable - to test
your app on different/upcoming android versions ). You may click here for droid incredible specific review/tips/usage.


  1. post some appinventor tutorials dear...and you can send us @

  2. Well said, I blog because I enjoy it. I try not to get caught up in the comparison game. It is a process and you really do have to call on your better angels at times, but the minute this stops being fun for me about iphone and application development. Thanks for this great post.

  3. Android development are very famous for in the mobile era.

    The Team Android phenomenon is spreading like wildfire. Lots of people are turning to the openness and diversity of Android smartphones when choosing a mobile device. The iPhone boasts the most robust selection of apps, but many developers are now also creating software for the Android Market.

  4. I wanted to make 3d games for indroid.
    but was having so many issues.
    but when i read your article in this the most is Tutorial of Indroid Game
    so it was easy for me to work.
    thanks for sharing this

    get a facebook fan page

  5. By read your post I got a good idea about Android application development.This is one of the valuable post.
    Android app developers

  6. You are address way to advance your business, peoples can calmly to accepted about your business or restaurant and to your business to be added

    Android developers

  7. That's a good piece of code you posted here. And it'll be great to see some appinventor tutorials here. Regards, Thomas from android programming

  8. Guys check this out..... If you have ideas on mobile apps for use on phones, submit ur apps a contest that gives you a chance to prove your mettle. Whether you are a professional developer or a student, every1 can submit their apps developed by using the Series 40 Web apps SDK and win.
    Register today to submit ur apps....

  9. I would like to thankx for the efforts you have put in writing this site. I’m hoping the same high-grade post from you in the upcoming as well.

    1. android app development
      I have seen your android coding.Your coding is very interesting.Appreciate you sharing, great post.Really thank you! Fantastic.

  10. Interesting Article.
    Hoping that you will continue posting an article having a useful information.

    Android Apps

  11. Android Tutorial for Beginners learns android programming and how to develop android mobile phone and ipad applications starting from environment setup.

  12. Wow…can I really make money from home? What an idea and the best that I’ve heard in ages. Your website is cool and fun, and your blog is wonderful. I am very happy that I came across your write-up. Now, I am all set to take your advice and make my life worth living as a freelancer. Who would have thought that I am also an eligible candidate. I am sure to visit sell my creative graphic design,superb logo design that are open to people like me. Kudos!

  13. I surprise how much effort you put to create such a great informative website! Android Game Development

  14. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.
    Android Training in chennai | Best Android Training in chennai|Android Training in chennai with placement

  15. The Blog Content is very informative and helpful. Please share more content. Thanks.
    Android Training
    Android Institute
    Android Course

  16. Really I am very much appreciating to here to read such type of informative blog. Fixx Group is an web design and development firm that specializes in creating affordable Web Design and Web Development company in India, Ghaziabad
    Mobile app Development company in Ghaziabad
    IOS app Development company in Ghaziabad
    Android app Development company in Ghaziabad
    Website Development company in Ghaziabad

  17. thanks for sharing the information.
    Indian Cyber Army’s most awaited internship is live now. Summer Internship 2018 on “ Ethical hacking” and book your seats before it runs out.Candidates have to get themselves registered to be a part of this Internship program. Here internship will give you on-the-job experience, help you learn whether you and Cyber security industry are a good match and can provide you with valuable connections and references. Here interns are usually exposed to a wide variety of tasks and responsibilities which allows the intern to showcase their strengths by working on projects for various managers that work on different parts of Indian Cyber Army. Becoming a high performing intern is a fantastic way to improve your employment prospects. This internship can be a great way to get your foot in the door of success with a prestigious or desirable Organization.As career in ethical hacking is most in demand.

  18. Thanks for the information.It is really nice .Information security is the set of processes that maintain the confidentiality, integrity and availability of business data in its various forms.In this age of Technology advancement, computer and information technology have not only brought convenience to citizens in modern life but also for policemen & various Government officials of the nation to fight cybercrime through various modus operandi. Indian Cyber Army has been dedicated in fighting cyber crime, striving to maintain law and order in cyberspace so as to ensure that everyone remains digitally safe.Read more:- Information Security