Button differentiation in android
<p>I am new to android.I am developing an application in that i have two buttons in 1 screen.I have to perform to different actions based on the particular button clicked.I have to differentiate according to which button is clicked. </p>

<pre><code>public void showSelectedNumber(int type, String number)
{


         ---&gt;Here i have to set two conditions:
    1.This for call
         try 
         {
    //     Intent callIntent = new Intent(Intent.ACTION_CALL);      //Call options
    //////     Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
    //////     while (cursor.moveToNext()) {
    //////         String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
    //////     }
    //     callIntent.setData(Uri.parse("tel:"+number));    
    //     startActivity(callIntent);


    This is for SMS:

        startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("sms:"                         //sms options
                + number)));
         }
         catch (ActivityNotFoundException e) 
         {
         Log.e("helloandroid dialing example", "Call failed", e);
         }
        Toast.makeText(this, type + ": " + number, Toast.LENGTH_LONG).show();      
    }
    }
</code></pre>
