Thursday, December 15, 2011

Top 25 Companies for Work-Life Balance in 2011

When it comes to balancing work with personal life see what companies rate the highest
according to employees.

Top 25 Winners
Ratings Scale: 5.0 - 4.01 = “Very Satisfied” 4.0 - 3.51 = “Satisfied”
Note: All ratings are for 04/01/10 - 03/31/11
How the Top 25 Were Selected

The Top Companies for Work-Life Balance list is based on employee feedback shared in company reviews on Glassdoor. Each company
review survey consists of 20 questions that capture employees’ attitudes about workplace factors, including Senior Leadership, Communication,
Employee Morale, Career Opportunities, Work-Life Balance, Compensation and Benefits, Recognition and Feedback, and Fairness and
Respect. The final ranking of each company on this list was determined by its overall work-life balance rating for the 12-month period ending
March 31, 2011.

Read more here.

2012 Best Places to Work – Employees’ Choice Awards

Best Places to Work – Employees' Choice Awards

Glassdoor is excited to announce our fourth annual Employees' Choice Awards for Best Places to Work. Our Top 50 winners were selected by the people who know these companies best — their employees! based on the input of those people who know these companies best — the employees! Criteria include employer ratings, such as career advancement and compensation, and CEO approval ratings. The ranking is determined based on the results of a 20-question survey that captures employees’ attitudes about: Career Opportunities, Communication, Compensation & Benefits, Employee Morale, Recognition & Feedback, Senior Leadership, Work/Life Balance, and Fairness & Respect.

Below is the list of top 50 Winners for the year 2012.

Employer Ratings Scale: 3.51-4.0 = “Satisfied” 4.01-5.0 = “Very Satisfied”

Read more here.

Wednesday, December 14, 2011

Delete the whole Contacts from the android mobile

To delete all contacts from the contacts of android phone.
By executing the below lines will delete  all contacts from phone book permenently.

Cursor cur = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null,null, null, null);
while (cur.moveToNext()) {
try {
    String lookupKey = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
    Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI,lookupKey);                            System.out.println("The uri is " + uri.toString());
    int deletedContacts=cr.delete(uri, null, null);
    log.i("","No.of deleted Contacts: "+deletedContacts);
  } catch (Exception e) {
This works on android 2.2 and above.
Please dont forget to add these permissions in Manifest.xml

 <uses-permission android:name="android.permission.READ_CONTACTS" />
 <uses-permission android:name="android.permission.WRITE_CONTACTS" />

delete all call history by a particular number in android phone

To delete all call history associated with a particular number from the original call history of android phone.
By executing the below lines will delete  all call history by a particular number will gets erased permenently.

        String strUriCalls = "content://call_log/calls"; // URI for CallLog in 2.2 and above
        Uri UriCalls = Uri.parse(strUriCalls);
        String queryString = "NUMBER='" + number + "'";
        Log.v("Number", queryString);
        int noofDeletedRows = getContentResolver().delete(UriCalls, queryString, null);
        Log.v("Number", "Deleted Rows deleted"+noofDeletedRows +" with the specified number:" + number);
Works on version 2.2 and above.

Removes the specified Call row permently from the CallLog in ANDROID

AIM : To removes the specified Call row from the Call Log in ANDROID
The following method does the function. It requires "CALL LOG ID" of a particular callLog row.

        String strUriCalls = "content://call_log/calls";
        Uri UriCalls = Uri.parse(strUriCalls);
        String queryString = Calls._ID + "='" + rowID + "'";
        Log.v("Number", queryString);
        int i = getContentResolver().delete(UriCalls, queryString, null);
        Log.v("Number", "Deleted Rows:" + i);
We Can read the CALL LOG ID of  particular row(call) in android call hisory.
By using the following lines.

Cursor c = contentResolver.query(Uri.parse("content://call_log/calls"),null,null, null,android.provider.CallLog.Calls.DEFAULT_SORT_ORDER);
        // Retrieve the column-indixes of phoneNumber, date and calltype
        int numberColumn = c.getColumnIndex(android.provider.CallLog.Calls.NUMBER);
        int dateColumn = c.getColumnIndex(android.provider.CallLog.Calls.DATE);
        // type can be: Incoming, Outgoing or Missed
        int typeColumn = c.getColumnIndex(android.provider.CallLog.Calls.TYPE);
        int durationColumn = c.getColumnIndex(android.provider.CallLog.Calls.DURATION);
        // Will hold the calls, available to the cursor
                // Loop through all entries the cursor provides to us.
                String callerPhoneNumber = c.getString(numberColumn);
                Long callDate = c.getLong(dateColumn);
                int callType = c.getInt(typeColumn);
                int duration = c.getInt(durationColumn);
                    case android.provider.CallLog.Calls.INCOMING_TYPE:
                    case android.provider.CallLog.Calls.MISSED_TYPE:
                    case android.provider.CallLog.Calls.OUTGOING_TYPE:

                String cName=c.getString(c.getColumnIndex(android.provider.CallLog.Calls.CACHED_NAME));
                String cId=c.getString(c.getColumnIndex(android.provider.CallLog.Calls._ID));
SImilarly,you can read all properties of a calllog programatically.
It works on all above 2.2 + versions.

Create an auto-Scrolling Marquee TextView in android

Create a  textview that scroll text if text is not fit in the specified width,without need to focus just like Android Market app description screen.

This solution able to scroll text inside a TextView without it required to be focused. For some strange reason there isn't an easy way to do this natively.

Generally, textview will marque the text when it is focused only.
By using the below code,the textview will automatically scroll even without focus to textview.

Step 1: Create an autoscrolltextview by extending textview (
public class ScrollingTextView extends TextView {

    public ScrollingTextView(Context context, AttributeSet attrs,
            int defStyle) {
        super(context, attrs, defStyle);

    public ScrollingTextView(Context context, AttributeSet attrs) {
        super(context, attrs);

    public ScrollingTextView(Context context) {

    protected void onFocusChanged(boolean focused, int direction,
            Rect previouslyFocusedRect) {
        if (focused) {
            super.onFocusChanged(focused, direction, previouslyFocusedRect);

    public void onWindowFocusChanged(boolean focused) {
        if (focused) {

    public boolean isFocused() {
        return true;

Step 2:  Use this XML tag in your XML layout.
                 android:text="autoscrollable textview without focus to textview...working...."
This will get you the scrolling marquee behavior desired out of the TextView control!

Friday, November 25, 2011

Create android application with no application Icon

AIM: To create an app with no icon and run in background without any activity required.


When you want to track the usage of the mobile or gather some data without user knowledge,this might help you.

Step1: Create an application with No icon.
 Normally,an activity is declared as follows in manifest.
            android:name="" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
Remove the Category TAG ,you wont get app icon anymore.
Now,you don't need activity anymore. so remove this segment.
BUt you might think,how the app will run without any trigger or what is the starting point of the application.
This is the solution.

<!-- Start the Service if applicable on boot -->
        <receiver android:name="" >
            <intent-filter >
                <action android:name="android.intent.action.BOOT_COMPLETED" />

THis triggers your code that written in Receiver there by you can run service to implement your thoughts.

  <service android:name="" />

You need to add this permission,

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Your code runs when the phone reboots only.

Step 2. Write your code

On Reboot,the recevier will fire ,there you can start your service.

class ServiceStarter extends BroadcastReceiver {

    public void onReceive(Context _context, Intent _intent) {
        Intent i = new Intent("com.prac.test.MyPersistingService");
        i.setClass(_context, ServiceCode.class);


Thats it.

THis enables the app runs in background and it wont have any app icon.the service always does its function..

Free Android apps for Online Meetings:Mikogo

Mikogo has released its iOS and Android apps enabling people to attend online meetings from their mobile phones or tablets. Designed for participating in web presentations or meetings, the apps are now available online as a free download.
BeamYourScreen has announced the release of its mobile apps for its desktop sharing software, Mikogo. Mikogo enables businesses to organize online meetings live over the Web and with this new release, now offers a solution for users to participate in meetings while on the go, direct from their mobile phones or tablets.
The apps are designed for participating in online meetings and presentations, specifically for those who cannot attend an online meeting from their desktop computer. When unable to make it to their laptop or desktop computer for an online meeting, a traveling businessperson can participate effortlessly and view all the meeting content in real-time on the screen of their mobile device.
Users simply download the free app to their phone or tablet. They are then ready to join a Mikogo online meeting from anywhere, assuming they have access to a wireless Internet or 3G network connection. From their laptop or desktop computer, the online meeting presenter then starts a Mikogo session and receives the unique Mikogo session ID. Meeting participants then enter this session ID into their mobile app and will be instantly joined to the online meeting. They can then view the screen of the presenter live from their mobile phone or tablet.

Both the iOS and Android apps are available:

This post  is  a copy of post found at

Thursday, June 30, 2011

PAYPAL integration in ANDROID applications


Everybody know about paypal in real time . and this post may be helpful for you in you want to integrate paypal in your android application for any payment processes.
Paypal REleased an API and Library for MObile Integration.

You can integrate by using PAYPAL Mobile Libaraies.
PayPal Mobile Library
PayPal MerchantSetupAdministrationGuide
PayPal sandBOX Document

PayPal MOBILE library API document

please check out this Paypal Link:

Try it once in your applications.

Sample application for DUAL SCREEN Android Mobile by SPRINT&Kyocera

You may aware the concept of DUAL SCREEN Mobile released by Sprint and Kyocera.

If you didn't ,just look at this post. Really nice and cool idea to have two screens on a mobile.

The developer API is released and you can download from this link.

You can just start work on this mobile just follow these steps.

Open AVD manager
Click on Avalible Packages
select THIRD PARTY addon's
You can find Kyocera Addon ,please check the screenshot.

The following is a sample project that shows how to run in the mobile.

Have a try at it .

Wednesday, March 9, 2011

Get Current Screen Orientation in ANDROID

AIM:  Get Current Screen Orientation in ANDROID
The following method does the required functionality.

public int getScreenOrientation() {

// Query what the orientation currently really is.
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)                {
   // The following message is only displayed once.
    return 1; // Portrait Mode

}else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
   // The following message is only displayed once.
    return 2;   // Landscape mode
return 0;

This is simple and effective.

Please let me know if any.

Images with Coverflow like animation in ANDROID

AIM:  To show an array of images in CoverFlow like animation in ANDROID Gallery.
We need to create one custom gallery extends Gallery.

File 1: 
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Transformation;
import android.widget.Gallery;
import android.widget.ImageView;

public class CoverFlow extends Gallery {

     * Graphics Camera used for transforming the matrix of ImageViews
    private Camera mCamera = new Camera();

     * The maximum angle the Child ImageView will be rotated by
    private int mMaxRotationAngle = 60;
     * The maximum zoom on the centre Child
    private int mMaxZoom = -120;
     * The Centre of the Coverflow
    private int mCoveflowCenter;
 public CoverFlow(Context context) {

 public CoverFlow(Context context, AttributeSet attrs) {
  super(context, attrs);

  public CoverFlow(Context context, AttributeSet attrs, int defStyle) {
   super(context, attrs, defStyle);
     * Get the max rotational angle of the image
  * @return the mMaxRotationAngle
 public int getMaxRotationAngle() {
  return mMaxRotationAngle;

  * Set the max rotational angle of each image
  * @param maxRotationAngle the mMaxRotationAngle to set
 public void setMaxRotationAngle(int maxRotationAngle) {
  mMaxRotationAngle = maxRotationAngle;

  * Get the Max zoom of the centre image
  * @return the mMaxZoom
 public int getMaxZoom() {
  return mMaxZoom;

  * Set the max zoom of the centre image
  * @param maxZoom the mMaxZoom to set
 public void setMaxZoom(int maxZoom) {
  mMaxZoom = maxZoom;

     * Get the Centre of the Coverflow
     * @return The centre of this Coverflow.
    private int getCenterOfCoverflow() {
        return (getWidth() - getPaddingLeft() - getPaddingRight()) / 2 + getPaddingLeft();
     * Get the Centre of the View
     * @return The centre of the given view.
    private static int getCenterOfView(View view) {
        return view.getLeft() + view.getWidth() / 2;
  * {@inheritDoc}
  * @see #setStaticTransformationsEnabled(boolean)
    protected boolean getChildStaticTransformation(View child, Transformation t) {
  final int childCenter = getCenterOfView(child);
  final int childWidth = child.getWidth() ;
  int rotationAngle = 0;
        if (childCenter == mCoveflowCenter) {
            transformImageBitmap((ImageView) child, t, 0);
        } else {    
            rotationAngle = (int) (((float) (mCoveflowCenter - childCenter)/ childWidth) *  mMaxRotationAngle);
            if (Math.abs(rotationAngle) > mMaxRotationAngle) {
             rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle : mMaxRotationAngle;  
            transformImageBitmap((ImageView) child, t, rotationAngle);        
  return true;

  * This is called during layout when the size of this view has changed. If
  * you were just added to the view hierarchy, you're called with the old
  * values of 0.
  * @param w Current width of this view.
  * @param h Current height of this view.
  * @param oldw Old width of this view.
  * @param oldh Old height of this view.
     protected void onSizeChanged(int w, int h, int oldw, int oldh) {
      mCoveflowCenter = getCenterOfCoverflow();
      super.onSizeChanged(w, h, oldw, oldh);
      * Transform the Image Bitmap by the Angle passed
      * @param imageView ImageView the ImageView whose bitmap we want to rotate
      * @param t transformation
      * @param rotationAngle the Angle by which to rotate the Bitmap
     private void transformImageBitmap(ImageView child, Transformation t, int rotationAngle) {       ;
      final Matrix imageMatrix = t.getMatrix();;
      final int imageHeight = child.getLayoutParams().height;;
      final int imageWidth = child.getLayoutParams().width;
      final int rotation = Math.abs(rotationAngle);
      mCamera.translate(0.0f, 0.0f, 100.0f);
      //As the angle of the view gets less, zoom in    
      if ( rotation < mMaxRotationAngle ) {
       float zoomAmount = (float) (mMaxZoom +  (rotation * 1.5));
       mCamera.translate(0.0f, 0.0f, zoomAmount);        
      imageMatrix.preTranslate(-(imageWidth/2), -(imageHeight/2));
      imageMatrix.postTranslate((imageWidth/2), (imageHeight/2));
File 2:
Activity Class ,where you need to show the Coverflow of Images

public class CoverFlowExample extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
     CoverFlow coverFlow;
     coverFlow = new CoverFlow(this);
     coverFlow.setAdapter(new ImageAdapter(this));

     ImageAdapter coverImageAdapter =  new ImageAdapter(this);
     coverFlow.setSelection(4, true);

 public class ImageAdapter extends BaseAdapter {
     int mGalleryItemBackground;
     private Context mContext;

     private FileInputStream fis;
     private Integer[] mImageIds = {

     private ImageView[] mImages;
     public ImageAdapter(Context c) {
      mContext = c;
      mImages = new ImageView[mImageIds.length];
  public boolean createReflectedImages() {
          //The gap we want between the reflection and the original image
          final int reflectionGap = 4;
          int index = 0;
          for (int imageId : mImageIds) {
        Bitmap originalImage = BitmapFactory.decodeResource(getResources(), 
           int width = originalImage.getWidth();
           int height = originalImage.getHeight();
           //This will not scale but will flip on the Y axis
           Matrix matrix = new Matrix();
           matrix.preScale(1, -1);
           //Create a Bitmap with the flip matrix applied to it.
           //We only want the bottom half of the image
           Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height/2, width, height/2, matrix, false);
           //Create a new bitmap with same width but taller to fit reflection
           Bitmap bitmapWithReflection = Bitmap.createBitmap(width 
             , (height + height/2), Config.ARGB_8888);
          //Create a new Canvas with the bitmap that's big enough for
          //the image plus gap plus reflection
          Canvas canvas = new Canvas(bitmapWithReflection);
          //Draw in the original image
          canvas.drawBitmap(originalImage, 0, 0, null);
          //Draw in the gap
          Paint deafaultPaint = new Paint();
          canvas.drawRect(0, height, width, height + reflectionGap, deafaultPaint);
          //Draw in the reflection
          canvas.drawBitmap(reflectionImage,0, height + reflectionGap, null);
          //Create a shader that is a linear gradient that covers the reflection
          Paint paint = new Paint(); 
          LinearGradient shader = new LinearGradient(0, originalImage.getHeight(), 0, 
            bitmapWithReflection.getHeight() + reflectionGap, 0x70ffffff, 0x00ffffff, 
          //Set the paint to use this shader (linear gradient)
          //Set the Transfer mode to be porter duff and destination in
          paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN)); 
          //Draw a rectangle using the paint with our linear gradient
          canvas.drawRect(0, height, width, 
            bitmapWithReflection.getHeight() + reflectionGap, paint); 
          ImageView imageView = new ImageView(mContext);
          android.widget.Gallery.LayoutParams imgLayout = new CoverFlow.LayoutParams(320, 480);
          imageView.setPadding(30, 100, 20, 20);
          mImages[index++] = imageView;
       return true;

     public int getCount() {
         return mImageIds.length;

     public Object getItem(int position) {
         return position;

     public long getItemId(int position) {
         return position;

     public View getView(int position, View convertView, ViewGroup parent) {

      //Use this code if you want to load from resources
         ImageView i = new ImageView(mContext);
         i.setLayoutParams(new CoverFlow.LayoutParams(380, 450));
         //Make sure we set anti-aliasing otherwise we get jaggies
         BitmapDrawable drawable = (BitmapDrawable) i.getDrawable();
         return i;
      //return mImages[position];
   /** Returns the size (0.0f to 1.0f) of the views 
      * depending on the 'offset' to the center. */ 
      public float getScale(boolean focused, int offset) { 
        /* Formula: 1 / (2 ^ offset) */ 
          return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset))); 

The output will be as follows ( in GAlaXY TABlet) 

Please let me know if any.

Access LOGCAT DATA in your ANDROID application Progrmatically.

To read the LOGCAT data in your application which is very helpful  for bugreport purposes and for trobleshooting the device issues from remote location.


You can check LOGCAT API documentation at  developer site.

Writing program to use that API and to print your logcat data in a Scrollable TextView.

     public class ReadLogCat extends Activity {
      public void onCreate(Bundle savedInstanceState) {
        try {
          Process process = Runtime.getRuntime().exec("logcat -v");// Verbose filter
/*  Check diffrent filters available at , Options section */

          BufferedReader bufferedReader = new BufferedReader(
          new InputStreamReader(process.getInputStream()));
          StringBuilder logString=new StringBuilder();
          String line;
          while ((line = bufferedReader.readLine()) != null) {
          TextView tv = (TextView)findViewById(;
        } catch (IOException e) {

2) To perform this operation we need to set Permissions in AndroidManifest.xml file as 

<uses-permission android:name="android.permission.READ_LOGS" />

3) The following is the LOGCAT window in ECLIPSE IDE.

Logcat window in ECLIPSE
 Post your comments if any .

Monday, January 31, 2011

To Check internet Connection status/Type in Android

Aim: To Check internet Connection status/Type in Android.
Here is some example code to check the network status .

void chkConnectionStatus()
  ConnectivityManager connMgr = (ConnectivityManager)

final wifi =

final mobile =

if( wifi.isAvailable() ){
Toast.makeText(this, "Wifi" , Toast.LENGTH_LONG).show();
else if( mobile.isAvailable() ){
Toast.makeText(this, "Mobile 3G " , Toast.LENGTH_LONG).show();
{Toast.makeText(this, "No Network " , Toast.LENGTH_LONG).show();}

This snippet requires the following permissions in AndroidManifest.xml file.

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

Please let me know if any.

Android Developers Blog

Ram's shared items