Example usage for android.content Intent Intent

List of usage examples for android.content Intent Intent

Introduction

In this page you can find the example usage for android.content Intent Intent.

Prototype

protected Intent(Parcel in) 

Source Link

Usage

From source file:Main.java

public static void dial(Context context, String number) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + number));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from ww  w. j  a  v a 2 s .c  o  m*/
}

From source file:Main.java

public static Intent buildImageCaptureIntent(Uri uri) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    return intent;
}

From source file:Main.java

public static void openEmail(Context context, String email) {
    Intent data = new Intent(Intent.ACTION_SENDTO);
    data.setData(Uri.parse(email));//w w  w.ja  v  a  2  s  .c  o m
    context.startActivity(data);
}

From source file:Main.java

public static void goToNetworkSetting(Context context) {
    Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS);
    context.startActivity(intent);
}

From source file:Main.java

public static Intent getAndroidImageShareIntent(CharSequence chooseTitle, String pathfile) {
    Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("image/*");
    share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathfile));
    return Intent.createChooser(share, chooseTitle);
}

From source file:Main.java

public static void sendSms(Context context, String phoneNum, String content) {
    Intent mIntent = new Intent(Intent.ACTION_VIEW);
    mIntent.putExtra("address", phoneNum);
    mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mIntent.putExtra("sms_body", content);
    mIntent.setType("vnd.android-dir/mms-sms");
    context.startActivity(mIntent);/*  w  w w  .java2s  . co  m*/
}

From source file:Main.java

public static void startCall(Context context, String uri) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(uri));/*from   w  ww.ja  va  2  s. c  o m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void composeSms(Context context, String phoneNumber, String smsBody) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.putExtra("sms_body", smsBody);
    intent.putExtra("address", phoneNumber);
    intent.setType("vnd.android-dir/mms-sms");
    context.startActivity(intent);/*from w ww . ja  v a2 s .  c o m*/
}

From source file:Main.java

public static Intent getTakePhotoIntent(Uri imageUri) {
    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
    intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
    return intent;
}

From source file:Main.java

public static void removeShortCut(Context context, String appName, Intent tagIntent) {
    Intent intent = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, appName);
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, tagIntent);
    context.sendBroadcast(intent);//from   ww w  . j a v  a  2s.  com
}