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

public Intent(Context packageContext, Class<?> cls) 

Source Link

Document

Create an intent for a specific component.

Usage

From source file:Main.java

public static void goActivityForResult(Activity activity, Class clazz, int requestCode) {
    Intent intent = new Intent(activity, clazz);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void callPhone(Context context, String phoneNum) {
    Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNum));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from w  w  w .j av a 2s .  c  o  m*/
}

From source file:Main.java

public static <T> void jumpActivityNewTask(Activity activity, Class<T> targetActivity) {
    Intent intent = new Intent(activity, targetActivity);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activity.startActivity(intent);//  www.  jav  a  2  s .  c om
}

From source file:Main.java

public static void call(Context context, String phoneNumber) {
    context.startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber)));
}

From source file:Main.java

public static void onCallPhone(Context context, String mobile) {
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + mobile));
    context.startActivity(intent);//w  ww .j a  v  a2s  . c  o m
}

From source file:Main.java

public static void jump2Browser(Context context, String url) {
    Intent viewIntent = new Intent("android.intent.action.VIEW", Uri.parse(url));
    context.startActivity(viewIntent);/*from   www .j  a v  a2s  . c  o  m*/
}

From source file:Main.java

public static void startActivity(Context context, Class<?> c, boolean clearStack) {
    Intent intent = new Intent(context, c);
    if (clearStack)
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(intent);//  www.  j a  va2 s.  co m
}

From source file:Main.java

public static void startActivityForData(Activity activity, Class<?> cls, String data) {
    Intent intent = new Intent(activity, cls);
    intent.putExtra("data", data);
    activity.startActivity(intent);// w w w .j  av a 2  s  .  c  o m
}

From source file:Main.java

public static void openBrowser(Activity activity, String url) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    activity.startActivity(browserIntent);
}

From source file:Main.java

public static void chooseMediaFromExternal(Activity activity, int requestCode) {
    Intent choosePictureIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    activity.startActivityForResult(choosePictureIntent, requestCode);
}