***Last updated on 11 May 2013 ***

Monday, 25 February 2013

Learn android : Your first sensible app (PART 1)

Welcome back folks. From this post onwards we will continue with the development of something sensible.
Ok first of all the screenshot below will show you the views of the layout: graphical and the one which allows you to code.

You can drag-and-drop in the graphical interface and write the code in the other. We will be using "coding" not the graphical part. We will use it just to have a quick preview.



Now for the most of the part I will be talking about the XML code only. Beginning from now I am going to explain each and every line.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

This is your first line, you dont have to remember it as it is generated by the IDE itself. The main part that has to be noticed is that the Layout type mentioned here is relative.
And we will change it to a Linear Layout since we are still a beginner, so consider that Relative Layout at this point of time is not better for you. Please follow the following screenshot to change it to a Linear Layout.
Same as you do in HTML, you have to open and close the Linear Layout Tag.





When you see the layout in your graphical view. You wont find any changes but that doesnt means that they are the same. We will go deep into it further later. You have to deal with Linear Layout just keep that in mind.

The next post will be about some of its attributes and their respective explanations.


Friday, 15 February 2013

Project Exlorer Explored(CONTINUED)

Now some remaining folders :

assets,bins,libs : Dont care about these folders. Not important at this point of time .Ther have just some library files.

res :  This is the most used folder. Please be very particular about this. This will contain everything. The resources which you use such as "images","sounds","animations" etc. Go in this. It has been categorized for our convenience. We can add the categories as per our choice too.


1. drawable-xxxx
   The drawable folder has 3 sub folders and is differentiated on the basis of image quality. And yes it stores images. See phone has different resolutions and you simply can't use an image of 240*320 on your screen of 800*600. So to allow your app to be more user friendly or rather phone friendly these folders have been defined. The high resolution images can be sent to drawable-hdmi, medium to drawable-mdpi..and so on. When we will go more deep into it we will discover more about them.

2. layout
 This is used to store the different XML layouts we are using.You will see in it our home.xml file.

3. menu
   Menus are also layouts and this will store them. Menu is something where you see stuff like "About Us","Help" etc. in your android apps

4. values
    This folder is generally used to store some values. Just take it that way we will be discussing it later as we use it practically for better info.

Thats all in the Exploring stuff section.GOOD NEWS.ALL the boring part is over :-)
From next post the droiding fun begins.

Monday, 11 February 2013

Project Explorer Explored

What is "src" in my Project Explorer? 
As stated earlier by me in Android development we are going to deal with JAVA files and the XML files for most of the part. Every java file that you create goes in the source or "src" folder. The basic funda is that XML files will be developed to create layouts, how your app looks and then it will be embedded in the JAVA file(some how, I will tell you) to give it a proper functioning. For web developers it is just like making an html login form and then doing rest of the part through your php/C#/JSP programming.

Inside the "src" folder you can see the name "com.myfirm.myapp"
"com.myfirm.myapp" - is a package 

A package is nothing but a container of classes.
Those new to the concepts of programming think package of a folder which will store all the classes(i.e. *.JAVA files)


What is a "gen"?
Seriously speaking just don't care about this. It is a folder that contains the automatically generated files by JAVA. We use it very often(we will come to that part later). It is in the same package. BuildConfig.java : I dont know about it because I have never used it.
R.java : This is an automatically generated file. I am just telling you its use. It is used to let your graphic,sound,button elements to be read in programming. It basically sets up your resources(audio/video/images) so that we can use them in our Java files.

What is that thing "Android 2.2 and Android Dependencies"?
Well they are nothing but packages, they contain jar files. Jar files contain classes. Classes contains methods/functions which we can use to make our applications do something. For example if we are making any camera based application. Then to read the image we took we need some functions. Those will be provided to us with the help of these. We are working with Android2.2 that is why the name.
<<<<TO BE CONTINUED>>>>

Friday, 8 February 2013

Layout In Android

Well Hello, Today we are going to learn about Layouts. What are layouts? But first you all know that an android app consists of several screens or windows rather. For example when you open Angry Birds what you see first is a Welcome screen loading some stuff, then you see a screen where you choose the level you want to play etc. Well designing those screens and how they should look is all about layouts. For making android apps we will be using XML for layouts. See the following screenshot. The area marked as red has two tabs.

1. Graphical Layout : It is where you see how your layout/screen will look after you are done with your app. Dragging and dropping elements can be done here.


2. home.xml : It is the xml file that will be used for designing the Home class/activity's screen. Which means when your apps runs in your phone. Whenever the the Home Activity or the Home Class(Both are the same thing)  is run you are going to see the layout designed in home.xml. Any change done while dragging and dropping in the Graphical Layout will be reflected into your xml file. Beginners please do not use Graphical Layout for designing now. We will be using XML only and there is no need to refer XML as it is not required. So if you do not know XML, don't panic.

All the layout files must be stored/saved in res/layout

res : res is the resources directory in your project. Here all the project related data such as sound, buttons, animations,background images,icons etc. are saved.

These are somethings that I have covered in this post. Rest later..You can try changing the text "hello world" for the time being and see the changes reflected on the layout. By default the layout used in our xml file is Relative Layout. I will throw more light on that in my next post. For any queries shoot me with comments.

Tuesday, 5 February 2013

View your Hello World Application on the Emulator

This post is for extreme beginners and will tell them how to view any project on the Android Emulator. Here we are taking the Hello World App that we made in the previous post. Just follow the screenshots.
1. Open Windows Menu->Android AVD Manager












2. Select your AVD and click start













3.You will have the following "whatever"













Just click launch. Your emulator will be launched in few seconds. For admin privileges it might ask for your permission just allow the damn thing. Don't forget to unlock the screen just like in any android phone.

4.Now run your project. Right Click your project name on Project Explorer(See I told you its very useful). Click RunAs-> Android Application

Yuhuuu wait for a few seconds and its there in your emulator.


5. My emulator screen looks like this now.
IN CASE YOU HAVE SOME PROBLEM SAME OLD THING DROP A COMMENT OR MAIL ME. WILL BE BACK SOON WITH SOME IMPORTANT CONCEPTS


Setting up your first android project


This post will focus on how to setup your first android project. Sorry for being tooooooooo late. Just follow the screenshots.


1.This will be your default screen when you will open Eclipse. The project explorer is basically...let me think...yep its like a browser window that will show all the files related to your project.













2. Now go to File->New->Project. You will get the following window. Select the Android Application Project and Click Next.



3. Now as told earlier we will be developing applications for Android 2.2. Enter the relevant details. Explanations are given in the screenshot. Change the application name as you see in the screenshot. You can give it any name you want, but for learning purpose and to avoid any mistake just follow what I am doing.


4. A custom launcher icon is the icon of your application. For example you see birds
in Angry Birds Application icon..same thing. Those familiar with java or C++ Activity in android are nothing but another term given to classes.
Workspace is the location where your projects are saved on your hard drive.

5.  Browse the launcher icon. Doesn't requires any explanation




6. Now create the activity class. For the time being make it a Blank Activity.Click next.




7.  Follow the screenshot.



8. Click finish and your final screen should be like this.

 
More Explanations would be given in next post + We will begin with the layouts. Any queries, suggestions just leave here. Video Tutorials are in progress but first lets see the demand. For those with limited data plans, these tutes are specially for them.