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 startNaviNightMode_amap(Context context) {

    Intent mIntent = new Intent("com.autonavi.minimap");
    mIntent.putExtra("NAVI", "OPEN_NIGHT_MODEL");
    context.sendBroadcast(mIntent);/*  w w  w  .ja va2  s . c  o  m*/

}

From source file:Main.java

public static void sendBroadcast(Context context, String action) {
    Intent mIntent = new Intent(action);
    context.sendBroadcast(mIntent);
}

From source file:Main.java

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

From source file:Main.java

public static void sendBroadcast(Context context, String action) {
    context.sendBroadcast(new Intent(action));
}

From source file:Main.java

public static void sendTo(Context ctx, String sendWhat) {
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(Intent.EXTRA_TEXT, sendWhat);
    ctx.startActivity(shareIntent);/*from   w w w  .  j  a va2 s.c  o  m*/
}

From source file:Main.java

public static void shareAppInfo(Context context, String info) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, info);
    context.startActivity(intent);//w  w  w .  ja  va 2 s.  c o  m
}

From source file:Main.java

public static void enableBluetooth(Activity activity, int requestCode) {
    Intent intent = new Intent("android.bluetooth.adapter.action.REQUEST_ENABLE");
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static Intent getPdfFileIntent(String param) {
    Intent intent = new Intent("android.intent.action.VIEW");
    intent.addCategory("android.intent.category.DEFAULT");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    Uri uri = Uri.fromFile(new File(param));
    intent.setDataAndType(uri, "application/pdf");
    return intent;
}

From source file:Main.java

public static Intent getAllFileIntent(String param) {
    Intent intent = new Intent("android.intent.action.VIEW");
    intent.addCategory("android.intent.category.DEFAULT");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    Uri uri = Uri.fromFile(new File(param));
    intent.setDataAndType(uri, "*/*");
    return intent;
}

From source file:Main.java

public static Intent getWordFileIntent(String param) {
    Intent intent = new Intent("android.intent.action.VIEW");
    intent.addCategory("android.intent.category.DEFAULT");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    Uri uri = Uri.fromFile(new File(param));
    intent.setDataAndType(uri, "application/msword");
    return intent;
}