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 Intent openGallery() {
    return new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
}

From source file:Main.java

public static void goHome(Activity parent) {
    Intent i = new Intent(parent, Main.class);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP + Intent.FLAG_ACTIVITY_NEW_TASK);
    parent.startActivity(i);/*  w w w .  java2s.  com*/
}

From source file:Main.java

public static Intent getSmsIntent(String number) {
    return new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + number));
}

From source file:Main.java

public static Intent selectPhoto() {
    Intent intent = new Intent(Intent.ACTION_PICK, null);
    intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");

    return intent;
}

From source file:Main.java

public static Intent getCallIntent(String phoneNumber) {
    Intent intent = new Intent("android.intent.action.CALL", Uri.parse("tel:" + phoneNumber));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

private static Intent getIntent(Context context, Class clazz) {
    return new Intent(context, clazz);
}

From source file:Main.java

public static Intent getDialIntent(String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

public static Intent getImageFromGallery() {
    Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    intent.setType("image/*");
    return intent;
}

From source file:Main.java

public static Intent createSmsToIntent(String text) {
    Intent sendIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"));
    sendIntent.putExtra("sms_body", text);
    return sendIntent;
}

From source file:Main.java

public static void newMessageNetwork(Context context) {
    Intent intent = new Intent(context, null);
    context.startActivity(intent);
}