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() 

Source Link

Document

Create an empty intent.

Usage

From source file:Main.java

public static void startAppByPackageName(Context context, String s) {
    new Intent();
    context.startActivity(context.getPackageManager().getLaunchIntentForPackage(s));
}

From source file:Main.java

public static Intent pickImage(int PICK_IMAGE) {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    intent.setAction(Intent.ACTION_GET_CONTENT);
    return Intent.createChooser(intent, "Select Picture");
}

From source file:Main.java

public static Intent share(final String content) {
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, content);
    sendIntent.setType("text/plain");
    return sendIntent;
}

From source file:Main.java

public static Intent getShareHtmlIntent(String htmlText) {
    Intent textIntent = new Intent();
    textIntent.setAction(Intent.ACTION_SEND);
    textIntent.putExtra(Intent.EXTRA_TEXT, "This is html");
    textIntent.putExtra(Intent.EXTRA_HTML_TEXT, htmlText);
    textIntent.setType("text/plain");
    return textIntent;
}

From source file:Main.java

public static Intent getRouteIntent(Uri uri) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(uri);
    return intent;
}

From source file:Main.java

public static Intent getShareImageIntent(Uri uri) {
    Intent image = new Intent();
    image.setAction(Intent.ACTION_SEND);
    image.putExtra(Intent.EXTRA_STREAM, uri);
    image.setType("image/*");
    return image;
}

From source file:Main.java

public static Intent getBundleIntent(Bundle bundle) {
    Intent intent = new Intent();
    intent.putExtras(bundle);
    return intent;
}

From source file:Main.java

public static void gotoHome(Context context) {
    Intent intent = new Intent();
    intent.setAction("GotoHome");
    context.sendBroadcast(intent);/*from   w ww.ja  v  a 2  s  .co  m*/
}

From source file:Main.java

public static Intent toRootPermission() {
    Intent intent = new Intent();
    intent.setAction("miui.intent.action.ROOT_MANAGER");
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    return intent;
}

From source file:Main.java

public static void startAttention(Context context, String s) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    intent.setData(Uri.parse(s));/*from w  w w.ja  v a  2s  . com*/
    intent.setClassName("com.tencent.mm", "com.tencent.mm.ui.qrcode.GetQRCodeInfoUI");
    context.startActivity(intent);
}