Search

Content

Android over view1/31/2017
>what is android?
android is mobile plotform consist of operating system, middleware, key apps.

>what is os?
os is a abstraction b/w software and hardware.

>architecture of android?
key applications:[ developed in java, c++, .net] now only support for java
Middle ware :[ native library open gl], [ java.io, javanet,dvm(.class<>dex)]
Operating System: [memory management, power management, Driver management, Resource management]

>life cycle of an android?


                 [ 1.Doesnot Exist ]
  onDestroy                            onCreate
  onStop                                  onStart
  onPause                                onResume


                [ 2. Fore Ground  ]                --->onPause    
                                                                                   [ 3. Pause ]
                                                               <----- onResume

    onResume                                        
    onStart                                 onPause
    onRestart                             onStop
                [ 4. Background ]


>how to get IMEI number in android?
TelephonyManager mTelephonyManager = (TelephonyManager)
            getSystemService(Context.Telephony_Service);
Stirng st = mTelephonyManager.getDeviceId();

>how to call a new Intent in android?
    StartActivity(new Intent(this, subactivity.class).putExtra("key","value");
    to get intent values
   Intent it=  getIntent();
   it.getString("key")

>what are the major components in android?
1.Activity
2.Service
3.Broadcatst Receiver
4.Content Provider

1.activity:
  Every screen with ui component user will interect is called as an activity.
                       javacode
         actvity
                     xml
2. service:
A long running process without user interaction is called as service.
example: wifi avalibile if some wifi is there, media player, network status

3.Broadcast Receiver
 broadcast receiver is registered for system announcemnt
Example: headset plungin, charger connected/disconnected, power button pressed

4.Content Provider:
used to share data b/w applications
Example : whatapp is getting contacts from contacts application.

>how to define string or string array in values.xml
<string name="key">value</stirng>
<string-array name="key">
     <item>value</item>
</stirng-array>

>what is difference b/w dp, dip, px, sp?
dp / dip: density independent pixels
sp: scale independent pixels
      it is scaled by user font size preference

>what is uuid in android?
universally unique identifier standardised 128bit string for Bluetooth service.

>what are the different android storages?

1.sharedpreferences
2.internal storage
3.external storage
4.sqlite
3.webservices to cloud

1. sharedpreferences:
sharedpreferences pref;
SharedPreferences.Editor editor ;
pref =  getApplicationContext().getSharedPreferences("name", MODE PRIVATE);
editor = pref.edit();

set items:
 editor.putString("name", "Elena");
 editor.putInt("idName", 12);
 editor.commit();

get the data:
String id= pref.getString("Key", null);

remove data
pref.remove("key");
pref.commit();

clear shared preference
pref.clear();
pref.commit();

>how to know wheter out listview is end?
 boolean userscrolled= false;
listview.setOnscrollListenet(new onScrollListener(){
   public void onScrollStateChanged(AbsListview view,int scrollstate)
     {
        if(scrollstate==OnScrollListener.SCROLL_STATE_TOUCH_SCROLL)
           {
              userScrolled = true;
            }
      }
    public void onScroll(AbsListView view, int fistVisibleItem, int visibleItemCount, int totalItemCount)
             {
               if(userscrool==true && fistVistiblecount+ totalVisiblecount == totalItemCount)
                       {
                                 //  end of listview
                        }     
              }
}


>what is intent?
intent is used to invoke antother actitiy

>what is d/w imlicet intent and explicit intent?
 implecent intent: used to invoke system components
 example: send message email
 Explicit intent: used to invoke user defined activity.

>what is a fragment?
 fragment is used to show mutiple view in a single activity.