Oct 19, 2011

Android API Difference between 3.0 and 4.0 OS - Ice Cream Sandwich


API Difference between Honeycomb and Ice Cream Sandwich

The overall difference between API Levels 13 and 14 is approximately 3.95%. The table below lists the numbers of program elements (packages, classes, constructors, methods, and fields) that were added, changed, or removed. The table includes only the highest-level program elements — that is, if a class with two methods was added, the number of methods added does not include those two methods, but the number of classes added does include that class.

Type Additions Changes Removals Total
Packages 5 48 0 53
Classes and Interfaces 90 192 0 282
Constructors 19 2 0 21
Methods 265 94 29 408
Fields 405 34 16 455
Total 804 370 45 1219

Here I found the list of removed classes, methods and interfaces in Android SDK 4.0.


  • ALBUM_ART 
  • freeze ()
  • FX_SURFACE_BLUR 
  • FX_SURFACE_DIM 
  • FX_SURFACE_MASK 
  • FX_SURFACE_NORMAL 
  • GPU 
  • HARDWARE 
  • HIDDEN 
  • hide ()
  • NON_PREMULTIPLIED 
  • obtain (long, long, int, int, int[], PointerCoords[], int, float, float, int, int, int, int)
  • PUSH_BUFFERS 
  • readData
    • type  (float[]) in android.renderscript.AllocationAdapter 
    • type  (int[]) in android.renderscript.AllocationAdapter 
  • SECURE 
  • setAlpha (float)
  • setDataSource (String)
  • setFlags (int, int)
  • setFreezeTint (int)
  • setLayer (int)
  • setMatrix (float, float, float, float)
  • setOrientation (int, int)
  • setPosition (int, int)
  • setSize (int, int)
  • setSummaryOff
    • type  (int) in android.preference.CheckBoxPreference 
    • type  (CharSequence) in android.preference.CheckBoxPreference 
  • setSummaryOn
    • type  (int) in android.preference.CheckBoxPreference 
    • type  (CharSequence) in android.preference.CheckBoxPreference 
  • setTransparentRegionHint (Region)
  • show ()
  • subData (int, FieldPacker)
  • subData1D
    • type  (int, int, byte[]) in android.renderscript.AllocationAdapter 
    • type  (int, int, float[]) in android.renderscript.AllocationAdapter 
    • type  (int, int, int[]) in android.renderscript.AllocationAdapter 
    • type  (int, int, short[]) in android.renderscript.AllocationAdapter 
  • subData2D
    • type  (int, int, int, int, float[]) in android.renderscript.AllocationAdapter 
    • type  (int, int, int, int, int[]) in android.renderscript.AllocationAdapter 
  • subElementData (int, int, FieldPacker)
  • SURACE_FROZEN 
  • SURFACE_BLUR_FREEZE 
  • SURFACE_DITHER 
  • SURFACE_FROZEN 
  • SURFACE_HIDDEN 
  • unfreeze ()

continue reading Android API Difference between 3.0 and 4.0 OS - Ice Cream Sandwich

Oct 10, 2011

Android Add menu in Share




Many times you might observe 3rd party application icon in Android Share menu. Suppose your application pick image/video from gallery, pick contact from contact book or pick audio from music player In this situation better options is to add your application menu in Share options so that user can directly select image/video from gallery or relavent application.

Share menu will display name & icon of your application

It is very easy to add menu in Share option.

Step 1 : Create Android project

Step 2 : Create activity named "MyShareMenu.java" (No need to create xml layout for this Activity)

Step 3: Register new activity in AndroidManiFest.xml file like following



<activity android:name="MyShareMenu">
            <intent-filter>
                <action android:name="android.intent.action.SEND"></action>
                <data android:mimetype="*/*"></data>
                <category android:name="android.intent.category.DEFAULT"></category>
            </intent-filter>
    </activity>
The importent part is data tag in that you can specify mimeType as per your application supports. For the demo purpose I have choose */* means every mimeType but you can write image/*, audio/* , video/* as per the need of your application.

Step 4: Fetch Uri of selected item, When user click on application from the Share menu, Android will call "MyShareMenu" activity with uri of selected item. Use following code to get Uri.

protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  
  Intent intent = getIntent();
  Bundle extras = intent.getExtras();
  String action = intent.getAction();
  
  // if this is from the share menu
  if (Intent.ACTION_SEND.equals(action)) {   
   if (extras.containsKey(Intent.EXTRA_STREAM)) {
    //  Get resource path
    Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM);
    Toast.makeText(this, "Selected File :" + uri.toString(), Toast.LENGTH_LONG).show();
    }
  } 
 }

In above code I have displays Toast but your can write business logic as per your need.


continue reading Android Add menu in Share