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 startActivity(Context context, Class cla) {
    context.startActivity(new Intent(context, cla));
}

From source file:Main.java

public static void goActivity(Activity activity, Class clazz) {
    Intent intent = new Intent(activity, clazz);
    activity.startActivity(intent);
}

From source file:Main.java

public static void closeNaviBroadcast_auto(Context context) {
    Intent intent = new Intent("android.intent.action.VIEW",
            android.net.Uri.parse("androidauto://mapOpera?sourceApplication=launcher&traffic=1"));
    intent.setPackage("com.autonavi.amapauto");
    context.sendBroadcast(intent);/* w w w. j av a  2 s.  c o m*/

}

From source file:Main.java

public static void startActivity(Activity activity, Class clz) {
    activity.startActivity(new Intent(activity, clz));
}

From source file:Main.java

public static Intent openActivity(Activity context, Class<?> activity) {
    Intent i = new Intent(context, activity);
    context.startActivityForResult(i, 1);
    return i;//ww  w  .  j  a  v a2 s  .co  m
}

From source file:Main.java

public static void startAct(Context context, Class activity) {
    context.startActivity(new Intent(context, activity));
}

From source file:Main.java

public static void stopService(Context context, Class<?> service) {
    Intent intent = new Intent(context, service);
    context.stopService(intent);//from w  ww.  j  ava  2s  .c  o m
}

From source file:Main.java

public static void enterActivity(Activity activity, Class clz) {
    Intent intent = new Intent(activity, clz);
    activity.startActivity(intent);
}

From source file:Main.java

public static void startNaviNightMode_auto(Context context) {

    Intent intent = new Intent("android.intent.action.VIEW",
            android.net.Uri.parse("androidauto://mapOpera?sourceApplication=launcher&switchNightMode=1"));
    intent.setPackage("com.autonavi.amapauto");
    context.sendBroadcast(intent);/*w w  w.j a v a  2 s .  c  om*/

}

From source file:Main.java

public static <T> void startService(Context context, Class<T> clazz) {
    Intent i = new Intent(context, clazz);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startService(i);//from ww  w .j  ava  2 s  . c  o  m
}