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 chooseVideoFromExternal(Activity activity, int requestCode) {
    Intent choosePictureIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
    activity.startActivityForResult(choosePictureIntent, requestCode);
}

From source file:Main.java

public static void playVideoOrAudio(Context context, Uri uri) {
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//w w  w.ja v a2  s . c om
}

From source file:Main.java

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

From source file:Main.java

public static void composeTel(Context context, String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:" + phoneNumber));
    context.startActivity(intent);/* ww w.ja va 2s.  c  o  m*/
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static void startActivity(Activity activity, Class claz, boolean finish, int delay) {
    Intent intent = new Intent(activity, claz);
    activity.startActivity(intent);/*  w ww . j a v a2 s  .c  om*/
    if (finish) {
        activity.finish();
    }
}

From source file:Main.java

public static void startService(Context context, String className) {
    try {/*w  w  w .j  av a2s.com*/
        Intent intent = new Intent(context, Class.forName(className));
        context.startService(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void downloadGooglePlayServices(Activity activity) {
    Intent marketIntent = new Intent(Intent.ACTION_VIEW,
            Uri.parse("market://details?id=com.google.android.gms"));
    activity.startActivity(marketIntent);
}

From source file:Main.java

public static void makeACall(String phonenUmber, Context context) {
    Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phonenUmber));
    context.startActivity(callIntent);//from www .j  a  v a 2s .  c  o m
}