Sunday, 22 July 2012

Android.............!!
  • its an mobile application software stack
  • has O.S(linux), library's, Dalvik virtual system,Framework,Application.
  • we write our program(application) on framework in Java.  
 Android components
  1. Activity  ---------------------- Each screen in android with which we can interact is an activity.
  2. Services ----------------------Its the task that runs at the background even without user interaction                   
  3. Content provider--------------It provides or shares information with other application.
  4. Broadcast Receiver-----------It gives all announcements.
  5. Intent-------------------------Forms a connection between components except with content provider.
  6. Manifest file------------------ Keeps overall information of its components.
 View------All small small rectangular boxes that we see on the screens are views.
                  -  like we see edit text box,button box,ckeck box etc

Functions  used
  1. onCreate()----------first function is called first by activity .
  2. setContentView()---to set final design screen on the top of graphical window.
  3. Toast.makeText(getApplicationContext(),"Text",duration)----prints text on screen,its like println in java.

Monday, 16 July 2012

final method in java

date:16/7/12
FINAL KEYWORD------->
1.final class   :    cant be extended, that means no sub class
                                declaration--:    public final class Myfinalclass
                                                             {
                                                              --------
                                                             }




2.final variable :  cant be modified,when we require any constant  in pgm thn declare tht as final
  • declaration: final<var>;
  • ex: public final int PI=3.145f
  • it behaves as constant,means cant be changed.
  • ex pgram---------final var-----------
  •  package mahajava;

  • public class Finalclass {
       
        public final float PI=3.14f;
       
       
       
        public void display()
        {
           
            PI++;  //compilation error,cant change final var

            System.out.println("final variable cant be changed");
        }
    }

    package mahajava;

    public class Finalclassm {

        /**
         * @param args
         */
        public static void main(String[] args) {
           
            // TODO Auto-generated method stub
            Finalclass f = new Finalclass();
            f.display();

        }

    }





    ---------------------->
    output
    ------------------------>

    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
        The final field Finalclass.PI cannot be assigned




3.final method  :  cant be overriden in  subclasses but can be accessed from derived classes, if  not private.
  •     declaration--: public final <return type><funtn name>
                                             ex: public final void display()
  •     why final ()?
          if we want to share some common functionality with derived classes  without changing its      implementation of the funtn shared then in such cases can make tht funtn as final.