6 June 2014

Set up the adt? (Part - 2)

Continued from the Part - 1  ...

Step 1 : So you may are now able to see this page.
activity_main

Step 2 : Now click activity_main.xml circled in the image above . You will see the xml code of your application .
activity_main xml

The xml file is situated in MyFirstProject ->res -> layout folder (circled in above image)
The xml files contains two elements A <RelativeLayout> and a <TextView>
A layout defines how the elements are placed in a page (defines the orientation of elements).

TextView contains the text you want to display on the screen .
(Try to change the Hello world text to your name and look at the GraphicalLayout).

 Step 3 : Double click on src ->  com.example.MyFirstProject -> MainActivity.java
mainactivity java

The java file named MainActivity.java will be opened.
You will find the following elements in it .
  1. package name ( package com.example.MyFirstProject)
  2. List of imports(Click on + button besides the import).
  3. MainActivity class which extends Activity .
  4. An onCreate method with a Bundle type argument .
  5. A predefined class called  setContentView(R.layout.activity_main) which takes argument as xml file (activity_main.xml).
  6. Ignore the method onCreateOptionsMenu since it does not have effect on the execution of the app if you delete it .
Step 4 : Click on the AndroidManifest.xml file and then again click on AndroidManifest.xml to let the program launch .

Step 5 : 
Check the line android:name="com.example.myfirstproject.MainActivity" which has name of our class MainActivity, hence MainActivity class will be executed first .

Also check on the line which says <action android:name="android.intent.action.MAIN" /> .MAIN says that it is the page which is going to be launched at the first place .
action MAIN

Step 5 : Click on the green button above and run the project  as Android Application and press OK shown below .
run app

Step 6 : You will see a Android mobile popped up called the Emulator .
emulator start

Check the Console marked above to see the activities running on the emulator .

Step 7 : After some time the mobile screen will be seen. Just drag the lock screen and the application will be seen with Hello World returned on the screen. (Wait till the application loads on the screen) .

output 1emulator output

 And you have made an android application.....Congratulations.

Stay tuned with Made In Android

Published By:
Unknown
on 6.6.14

Set up the adt (Part - 1)

Quite a simple thing to set up the adt .

Step 1 : Download adt from here:

Operating System Link
Windows (32 bit) https://dl.google.com/android/adt/adt-bundle-windows-x86-20140702.zip
Windows (64bit) https://dl.google.com/android/adt/adt-bundle-windows-x86_64-20140702.zip
Mac (64 bit) dl.google.com/android/adt/adt-bundle-mac-x86_64-20140702.zip
Linux (32 bit) dl.google.com/android/adt/adt-bundle-linux-x86-20140702.zip
Linux (64 bit) dl.google.com/android/adt/adt-bundle-linux-x86_64-20140702.zip
You have a compressed file of adt in your Downloads folder.

Step 2 : Extract the file with Winrar or any other extracting software .Save the Extracted file in the disk of your choice
I have saved it in C:/ disk (Windows) .

Step 3 : Open the adt folder. Open SDK Manager.exe and install al the packages.
See I have installed all the packages which go up to 34 GB which is the latest update. You can skip unwanted packages.

Step 4 : Right click on My Computer->Properties. Click on Advanced system settings in the left panel. Click on Environmental Variables..
envirmnment variables
Select PATH under Environment Variables and add path of platform tools,tools from sdk in adt and bin in jdk folder

NOTE: Each single path is followed by ; 

My path is shown below.
C:\adt-bundle-windows-x86\sdk\platform-tools\;C:\adt-bundle-windows-x86\sdk\tools\;C:\Program Files\Java\jdk1.8.0_11\bin;
PATH VARIABLE
Select New from System Variables. Give name as JAVA_HOME and path as that of jdk (C:\Program Files\Java\jdk1.8.0_11).Press OK.
JAVA_HOME

Step 5 : Select eclipse.exe from the eclipse folder

Step 6 : Select the workspace in which you want to save your project. (anomaly : package in java)and press O.K.
select workspace

Step 7 : After the Eclipse has loaded just cancel the Welcome page and Select New -> Android Application Project.
file new app

Step 8 : Give a name to your Project ( MyFirstProject ) and just click Next .

Step 9 : See that there are three ticks like those in the image below and click Next .
next set


Step 10 : Choose the icon for your app from your disk by clicking on Browse or let it be as it is  and click Next .

Step 11 : Choose BlankActivity and click Next .

Step 12 : Choose the name of java class and name of the XML file and click Finish .

Link to Part - 2

Stay Tuned with Made In Android

Published By:
Unknown
on 6.6.14

Previous Page Next Page Home
Top