Wednesday, July 27, 2011

opening a Dial-er Screen Android

In order open a Dial-er screen with the mobile no also android provides an intent.

Using this we will go to Dial-er screen.

In order use the intent we have to include a permission in the manifast.xml
<uses-permission android:name = "android.permission.CALL_PHONE"/>

Example:

Intent intent_Call = new Intent(Intent.ACTION_DIAL);
intent_Call.setData(Uri.parse("tel:" + strMobNo)); //strMobNo is the mobile no that we have to pass
startActivity(intent_Call);                                       //like 0123456789

how to make call in Android

Android provides default intent to manage calling.

Using this we directly go to calling screen.


In order use the intent we have to include a permission in the manifast.xml
<uses-permission android:name = "android.permission.CALL_PHONE"/>

Example:

Intent intent_Call = new Intent(Intent.ACTION_CALL);
intent_Call.setData(Uri.parse("tel:" + strMobNo)); //strMobNo is the mobile no that we have to pass
startActivity(intent_Call);                                       //like 0123456789

how to send an email

The snippet helps to send email from your android mobile.

Using this intent it will list a list of mail clients that are available to handle this intent.

If we select one of them then it will send email using that mail client.

Example.
 Intent emailIntent = new Intent(Intent.ACTION_SEND);
//Message Type
emailIntent.setType("text/image");

//To Address. Here strArrTo is an string array
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, strArrTO);

//CC . Here strArrCC is an string array
emailIntent.putExtra(android.content.Intent.EXTRA_CC, strArrCC);

//BCC. Here strArrBCC is an string array
emailIntent.putExtra(android.content.Intent.EXTRA_BCC, strArrBCC);

//Subject line. Here strSUB is string
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, strSUB);

//Body..Here strMes is string
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, strMes);

//Starting Intent...
startActivity(emailIntent);