How to create android applications?


Hello readers, welcome back!! I was running out of topics to scribble something in my blog. Finally one question which I used to ask from some months came to my mind “How these guys are making excellent applications (some of them are even free) for smartphones?” This article is to throw some light in the area of developing android applications.

 I have given an introduction about android in my previous blog Something aboutAndroid. Now, lets move on to something bigger

Introduction

Developers can create apps for the Android platform using the Android SDK.

Java is the major programming language for developing apps and it runs on Dalvik, a custom virtual machine designed for embedded systems:-runs on the top of Linux kernel. The application framework is very powerful and does most of the stuffs for the developers: - access device hardware, access location information, run background services, set alarms, notifications in status bar etc.

Every app runs on its own process with its own instance of DVM, which executes the file in Dalvik executable format (.dex). Dalvik has the capability to enable single device to run multiple VM (Virtual Machine) efficiently.

DVM = Register based à runs classes complied by JLM à transformed into .dex format using DX Tool

So, what about the .Net developers? Do they have to learn Java to create android app? Though, the core concept of c# and Java is the same, it’s not an easy job for .Net developers. Yeah, I know that..!!! Here’s the happy news

Though Java is the underlying code for Android OS, one company called XMarian became the game changer ripping out most of the java with c#. 

Xmarian has created platform called Mono allowing Android and iOS apps to be developed using c#, which runs on the top of Java. They have 2 major products MonoTouch – for iOS and MonoDroid – for Android.

Also company’s recent project - “XobotOS Research Project” shows the capability to remove java layer via “machine translation of Android from Java to C#”. In this project, more than million lines of Java code was converted to C# using tool called Sharpen.   

1st Android application

So, that was some theory about android app and its time to create one. Whenever we learn a new language, we always create “Hello World!” no matter Web, Windows applications.

a) In Java

Steps to create Hello World in java is given below

Language - Java should be installed in the PC

IDE - Install Eclipse IDE, which will make the development easy since it has great plug-in for project creation and management (Development can also be done using command-line without Eclipse)


Platform – At least one Android platform need to be installed in the SDK environment

AVD – Create an AVD (Audio Virtual Device), which defines the system image and device settings used by the Android Emulator (to run the applications)

Project – Create android project in Eclipse; - there are some basic properties in this step such as Build Target (to choose Android version), project name, package name etc.

Code – write the code: - one important class is Activity which can run and do work.

UI - Create the android user interface, composed of hierarchies of objects called “Views”. View is a drawing object used in UI layout such as button, image, label etc. Android provides an option to create alternate UI construction model – XML based layout files, to avoid changing source code for small UI changes.

Structure of XML = Tree of XML elements à each node is the name of View class

Run – Once the code is compiled run the app using Emulator that creates run configuration and launches the Android Emulator

Output – The extension of android application is .apk. In-fact this is a zip file disguised as an .apk. If we change the extension and un-zip, we can see a file named classes.dex, the most important file containing encrypted java files.

We can’t directly convert a jar file to an apk since it has to be compiled for Android. Eclipse IDE makes this job easier for us to create signed apk from java code.

b) In .Net

Steps to create Hello World in .Net is given below

Language – Install .Net Framework 4.0

IDE – Visual Studio 2010 is the best IDE available for creating .Net applications. We also need a plug-in “Mono for Android or MonoDroid” for creating Android apps.
Mono is an open source implementation of the .NET Framework based on the C# programming language and the Common Language Runtime (CLR). Mono tools make it possible for .NET developers to use their existing code, libraries, tools, and C# skills to build mobile apps for devices running Apple's iOS and Google's Android.

Project – Mono gives various options for creating new application – Library project, Android application, and OpenGL (Open graphics library for 2D and 3D graphics) application

Code – Similar to Java, Activity class is used in c# too, and this will be created on project creation

UI – Create the user interface for Android. XML based UI system (XAML and HTML) can be used to replace hard coded strings. The auto-generated Resource class is in the Resource.designer.cs and this should not be edited.

Emulator – MonoDevelop is the emulator used by Monodroid. We should choose a device on running the emulator

Deploy & Launch – Monodroid deploys the app to the emulator and then launches it.



Hands on with Eclipse

The detailed steps to develop apps using eclipse is given below

1) Install JDK – this is freely available in Java / Oracle web site

2) Install Android SDK Kit – free download from http://developer.android.com

3) Run Android SDK – You need to install the required Android packages and resources online (for each version such as 2.2, 2.3, 4.0 etc)

4) Install Eclipse for Java

5) Install the ADT plug in to create Android project in eclipse – you cannot create new android project without this

6) Run AVD Manager (this comes along with SDK) – Create virtual device bases on the android version and target device

7) Run Eclipse – Create new Android project – do some coding (many examples available online)

8) Compile and test it in AVD Manager

Conclusion

I hope my article has given some basics idea to .Net and Java developers who want to start developing android apps. The examples mentioned in the article are to create stand alone applications similar to windows apps.
What about web applications? While designing web applications don’t we have to think about smartphones? Hmm, may be next article!!! 

 If you like the article, post your comments and keep reading!!! Thanks ..See you later!!!

Resources

Creating apps in .Net - http://docs.xamarin.com/android

Comments

  1. Appreciate your comments. I will try to come up with more stuffs relevant to current technical era ...its never ending world ..is it !!!

    ReplyDelete
  2. Thanks a bunch for sharing this with all people you
    actually know what you're talking about! Bookmarked. Kindly additionally seek advice from my web site =). We may have a link trade agreement between us
    Also see my website - how to lose weight fast

    ReplyDelete
  3. Thanks , I have recently been searching for info about this
    subject for ages and yours is the greatest I've discovered till now. But, what in regards to the bottom line? Are you certain concerning the supply?
    My site > www.experimental.xf.cz

    ReplyDelete
  4. Hi! Someone in my Facebook group shared this site with us so I came to take a look.

    I'm definitely loving the information. I'm bookmarking and will be tweeting this
    to my followers! Terrific blog and amazing
    design and style.
    my webpage > myroutelog.com

    ReplyDelete
    Replies
    1. Thanks....ur blog is very unique in the idea...good

      Delete
  5. It's truly very complex in this active life to listen news on TV, therefore I simply use world wide web for that purpose, and get the most up-to-date news.
    Take a look at my web-site : how to download movies

    ReplyDelete
  6. Hi this is somewhat of off topic but I was wondering if
    blogs use WYSIWYG editors or if you have to manually code
    with HTML. I'm starting a blog soon but have no coding expertise so I wanted to get advice from someone with experience. Any help would be enormously appreciated!
    Also see my web page - free iphone

    ReplyDelete
    Replies
    1. Hi, the blog template is very simple and you dont need coding experience at all... you will get 2 formats - text (WYSIWYG) and html (with tags)... i use the 1st one and keep typing and inserting images...the preview option will show how exactly it will look after publishing... also u can chose a template to change the overall look-and-feel

      Delete
  7. Thanks for the good writeup. It if truth be told was a entertainment account it.
    Look complex to far added agreeable from you! However,
    how could we keep in touch?
    Feel free to visit my site ; learn piano

    ReplyDelete
  8. Woah! I'm really enjoying the template/theme of this website. It's simple, yet effective.

    A lot of times it's tough to get that "perfect balance" between superb usability and visual appearance. I must say you've done a superb job with this.

    Additionally, the blog loads super fast for me on Firefox.
    Superb Blog!
    Feel free to surf my site ... speed up my computer

    ReplyDelete
  9. Hi there to all, it's really a good for me to visit this site, it consists of useful Information.
    My webpage - Work from home

    ReplyDelete
    Replies
    1. Thanks...please do look at my latest post about mobile communication

      Delete
  10. Good replies in return of this matter with real arguments and describing the whole
    thing about that.
    Also visit my webpage nfl streaming

    ReplyDelete
  11. What's up to every body, it's my first visit of this web site; this web site carries awesome
    and really fine data in favor of readers.
    Here is my web-site ... www.buddymeets.com

    ReplyDelete
  12. It's in point of fact a nice and useful piece of information. I'm glad that you shared this useful info with us.
    Please keep us informed like this. Thanks for sharing.
    Also see my webpage > adsense alternatives

    ReplyDelete
  13. Hello there, You have done an incredible job. I will certainly
    digg it and personally suggest to my friends. I'm confident they will be benefited from this web site.
    Also visit my webpage :: lmqs1983.com

    ReplyDelete
  14. Hi there to every body, it's my first go to see of this website; this web site contains amazing and actually fine information designed for visitors.
    Look at my site ... Diablo 3 guide

    ReplyDelete
  15. Remarkable! Its genuinely awesome post, I have
    got much clear idea on the topic of from this piece of writing.
    My web page ... cigarettes online

    ReplyDelete
  16. Very nice article, exactly what I needed.
    Also see my website :: Asunnot Alanyassa

    ReplyDelete
  17. hello there and thank you for your info – I have certainly picked up something new from right here.
    I did however expertise several technical points using this website, as I experienced to
    reload the site lots of times previous to I could get it to load properly.
    I had been wondering if your hosting is OK? Not that I'm complaining, but sluggish loading instances times will sometimes affect your placement in google and can damage your high quality score if advertising and marketing with Adwords. Anyway I'm adding this RSS to my e-mail and can look
    out for much more of your respective exciting content.
    Make sure you update this again soon.
    my web site - asuntoturkista.net

    ReplyDelete
  18. Excellent web site you have got here.. It's hard to find high-quality writing like yours nowadays. I seriously appreciate individuals like you! Take care!!
    Here is my blog post :: tattoo removal

    ReplyDelete
  19. I just like the helpful information you supply on your
    articles. I'll bookmark your blog and check again here frequently. I'm fairly certain I will be
    informed many new stuff proper here! Good luck for
    the next!
    Visit my page - bleaching skin

    ReplyDelete
  20. Hiya very nice site!! Guy .. Beautiful .. Superb ..

    I'll bookmark your site and take the feeds additionally? I'm glad to
    search out so many useful info here in the post, we want work
    out extra techniques in this regard, thanks for sharing.
    . . . . .
    Feel free to visit my blog post - laser tattoo removal

    ReplyDelete
  21. Pretty component to content. I just stumbled upon your web site and
    in accession capital to assert that I acquire actually loved
    account your blog posts. Any way I will be subscribing for your
    feeds and even I success you access persistently rapidly.
    Visit my website :: http://livingmy1life.com/blogs/entry/Doctor-s-Suggestions-About-Ways-To-Get

    ReplyDelete
  22. This design is steller! You obviously know how to keep
    a reader entertained. Between your wit and your videos, I was almost
    moved to start my own blog (well, almost...HaHa!) Fantastic job.
    I really loved what you had to say, and more than that,
    how you presented it. Too cool!
    my web site > immobilienalanya.Net

    ReplyDelete
    Replies
    1. Thanks for comments...all the best for your new blog

      Delete
  23. Hi there, every time i used to check webpage posts
    here in the early hours in the dawn, as i love to find out more and more.
    Also visit my web-site - http://insainia.com/?module=VilmaCarna&params=28681

    ReplyDelete
  24. You can certainly see your enthusiasm within the work you write.

    The sector hopes for more passionate writers such
    as you who aren't afraid to mention how they believe. At all times follow your heart.
    Also see my website > complaindrain.com

    ReplyDelete

Post a Comment

Please add your valuable comments