Monday, July 2, 2012

creating your First Android Application



To Download  Full Program    Click Here



STEP 1:  Open Eclipse   -->   Click File


 






































STEP 2:     Click new -->  project


























STEP 3:     Select Android Project --> Click next










STEP 4:    Enter project Name   --> Click Next 
          




                                                                                

STEP 5:  Select the Version    --->  Click Next

























STEP 5:  Enter the package name    --->  Click Next

note: package name must have one dot with two names 

example :   (  and.com)     (s.s)     (an.pac.com)         (s.s.s)           etc...






STEP 6: See the project Explorer window, project is present there. If project Explorer not open,        Click Window --> show view --> project Explorer








STEP 7:  Expand your project













STEP 8:  Expand res folder in your project







STEP 9:  Expand layout folder 




















STEP 10:  open main.xml 
















Main.xml have two views.

1.Graphical layout   : In this we can do drag and drop controls here.  xml codes
 generated automatically  while designing in graphical layout.

2.main.xml                : In this We can write xml codings here for generating and aligning controls here.


(Those two tabs present in left below of black screen)

STEP 11:  click main.xml  tab.


























STEP 12:  Delete all codings in main.xml and add following codings.
                   (put double quotes correctly in the xml program) 


 <?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is my first Android Application!" />

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="And this is a clickable button!" />

</LinearLayout>





then click  Graphical Layout  tab.
















































 android:text="@string/hello" 

In this line,  @string refers a file. This file present in res --> values --> Strings.xml


















Open Strings.xml -->  It have two tabs.  1. Resources   2. strings.xml 

Click strings.xml tab.




                                    
                                  






































 android:text="@string/hello" 

hello represents   Hello World, HelloworldActivity!
  
app_name represents projectname





STEP 13:  click Save all  ( ctrl+shift+s)


STEP 14:  click run  ( Ctrl +F11)



 select Android Application.






OUTPUT:






click home button
 






























Then click Application launcher button.
















Note  that the HelloWorld application is now installed in the application launcher


































To Download  Full Program    Click Here



thank you... If you have doubt, feel free to ask and post here..

No comments:

Post a Comment