Tuesday, January 18, 2011

Learn Android starter for Java developers

What is Android?

Android is a software stack (solution for end to end users) for mobile devices that includes an operating system, middleware and key applications. The Android SDK(software development Kit - complete Integrated development libraries with basic help) provides the tools and APIs (application programming interfaces) that are necessary to begin developing applications on the Android platform using the Java programming language.

The stack consist of

· Application framework enabling reuse and replacement of components

· A virtual machine optimized for mobile devices

· Integrated browser based on the open source WebKit engine

· Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional)

· SQLite for structured data storage

· Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)

· GSM Telephony (hardware dependent)

· Bluetooth, EDGE, 3G, and WiFi (hardware dependent)

· Camera, GPS, compass, and accelerometer (hardware dependent)

· Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE

Now let's get hands dirty (start actual work of study including trial & error) , I appreciate Google teams & also various pages available across the net.

Here is a set of links that we recommend you follow to get up to speed with Android development. Most of these are from the official documentation page. We feel like the documentation isn't arranged too great, not everything is where you'd expect, making some things hard to find. In fact, while compiling this list, we came upon some very useful pages that mentioned as further reading. The order of these links might not as per the sequence and slightly different from the official documentation, and we also skipped some of areas, so make sure you look at the rest of the documentation based on your needs / necessities.

You can start with installing the Android SDK and related tools.

http://code.google.com/android/intro/installing.html

After that, follow these step-by-step instructions for a simple Hello World app. This will confirm you have your SDK and development environment set up correctly, and also give you a good introduction to basic Android concepts. http://code.google.com/android/intro/hello-android.html

Now get your hands even more dirty, and complete the Notepad tutorial. I strongly recommend this, even if it starts out boring! You'll learn more about UI creation, creating menus, using SQLite, creating apps with multiple screens, and dealing with life-cycle events. This tutorial assumes you're comfortable with Java, but you should be fine if you have experience with any OO language.

Now would be a good time to gain a better understanding of some of the underlying concepts. Some of these are stuff we discussed, but you should still read these. The activity reference page is probably the most important and will apply to almost all applications. This gives you basic details about the architecture, layers, events etc. basically needed to start actual coding

http://code.google.com/android/intro/anatomy.html

http://code.google.com/android/reference/android/app/Activity.html

http://code.google.com/android/reference/android/view/View.html

Now you may fell to get a richer UI (user interface). Let's go back & understand a bit about "view".

In any Android application, the user interface is built using "View" and "ViewGroup" objects. There are many types of views and view groups, each of which is a descendant of the View class. View objects are the basic units of user interface expression on the Android platform. The "View" class serves as the base for subclasses called "widgets," which offer fully implemented UI objects, like text fields and buttons. The "ViewGroup" class serves as the base for subclasses called "layouts," which offer different kinds of layout architecture, like linear, tabular and relative. This is somewhat we use to do in JAVA if you can recall in good old days.

To go in more details a typical "View" object is a data structure whose properties store the layout parameters and content for a specific rectangular area of the screen. A "View" object handles its own measurement, layout, drawing, focus change, scrolling, and key/gesture interactions for the rectangular area of the screen in which it resides. As an object in the user interface, a View is also a point of interaction for the user and the receiver of the interaction events. To know more please visit http://developer.android.com/guide/topics/ui/index.html

Now time for put a light on storage options, Android provides several options for you to save persistent application data. The solution you choose depends on your specific needs & necessities, such as whether the data should be private to your application or accessible to other applications (and the user) and how much space your data requires. Your data storage options are:

· Shared Preference : Store private primitive data in key-value pairs.

· Internal Storage: Store private data on the device memory.

· External Storage: Store public data on the shared external storage.

· SQLite Databases: Store structured data in a private database.

· Network Connection: Store data on the web with your own network server.

Android provides a way for you to expose even your private data to other applications — with a content provider. A content provider is an optional component that exposes read/write access to your application data, subject to whatever restrictions you want to impose. For more information about this have look at http://developer.android.com/guide/topics/data/data-storage.html

As we use to do with JAVA JDK use samples or the API demos that come with the SDK/ JDK. These are pre-installed in the emulator. We recommend going through all the items in the demo, to get a good understanding of who is doing what / event triggers etc. If you find some functionality that is similar to what you need in your app, you can locate the source code for that particular functionality and copy it into your project. This is code reusability & makes our life lot easier for next level learning. Also you can use the famous editor Eclipse which can add a great deal of environment help etc. Create a new project in Eclipse using the existing API Demos project folder to view and fool around with the source code.

Let's ponder more on this , Developing In Eclipse. The Android Development Tools (ADT) plugin for Eclipse adds powerful extensions to the Eclipse integrated development environment. This allows you to create and debug Android applications easier and faster. If you use Eclipse, the ADT plugin gives you an incredible boost in developing Android applications:

· It gives you access to other Android development tools from inside the Eclipse IDE. For example, ADT lets you access the many capabilities like take screenshots, manage port-forwarding, set breakpoints, and view thread and process information directly from Eclipse.

· It provides a New Project Wizard, which helps you quickly create and set up all of the basic files you'll need for a new Android application.

· It automates and simplifies the process of building your Android application.

· It provides an Android code editor that helps you write valid XML for your Android manifest and resource files.

· It will even export your project into a signed APK, which can be distributed to users.

To begin developing Android applications in the Eclipse IDE with ADT, you first need to download the Eclipse IDE and then download and install the ADT plugin. Have look at this like for further details http://developer.android.com/sdk/eclipse-adt.html#installing

For further please keep visiting & I will also let you learn my experiences step by step, feel free to get connected with me on ravindrapande@gmail.com. I am also on twitter & Facebook