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 activityClass) {
    Intent intent = new Intent(context, activityClass);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from  w  ww .  ja va 2s. c  o m*/
}

From source file:Main.java

public static Intent getIntent(Context context, Class clazz) {
    final Intent intent = new Intent(context, clazz);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

    return intent;
}

From source file:Main.java

public static void launchActivity(Context context, Class<?> activity) {
    Intent intent = new Intent(context, activity);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    context.startActivity(intent);//  w  ww.j  a  v  a2s . c o  m
}

From source file:Main.java

public static <T> void jump2interface(Context context, Class<T> where) {
    Intent intent = new Intent(context, where);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*ww w.ja  v a2s .co  m*/
}

From source file:Main.java

public static void redirectWithClearTop(Activity activity, Class<?> cls) {
    Intent intent = new Intent(activity, cls);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    activity.startActivity(intent);/*from  w ww  . ja v  a2  s  . com*/
    activity.overridePendingTransition(0, 0);
}

From source file:Main.java

public static void startActivityAndFinish(Activity context, Class<?> cls) {
    Intent intent = new Intent(context, cls);
    context.startActivity(intent);/*from   ww w .j  a va2 s  .  co m*/
    context.finish();
}

From source file:Main.java

public static void startActivityAndClear(Context act, Class<?> cls) {
    Intent intent = new Intent(act, cls);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    act.startActivity(intent);//  ww  w  .  ja  v a 2  s .c  o m
}

From source file:Main.java

public static void rateTheApp(Activity activity) {
    Intent goToMarket = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.giggs.apps.chaos"));
    activity.startActivity(goToMarket);/*  w w  w  .ja  v  a  2  s.  c  o  m*/
}

From source file:Main.java

public static void startActivityLeftOutRightIn(Context context, Class clazz) {
    Intent intent = new Intent(context, clazz);
    context.startActivity(intent);//from www  . j  ava2s. c  o  m
}

From source file:Main.java

public static void startActivityLeftInRightOut(Context context, Class clazz) {
    Intent intent = new Intent(context, clazz);
    context.startActivity(intent);/*from   w  w w . jav  a  2s  .  com*/
}