Example usage for android.content Context startActivity

List of usage examples for android.content Context startActivity

Introduction

In this page you can find the example usage for android.content Context startActivity.

Prototype

public abstract void startActivity(@RequiresPermission Intent intent);

Source Link

Document

Same as #startActivity(Intent,Bundle) with no options specified.

Usage

From source file:Main.java

public static void callImage(Context context, String path) {
    Intent intent = new Intent();
    intent.setDataAndType(Uri.fromFile(new File(path)), "image/*");
    context.startActivity(intent);
}

From source file:Main.java

/**
 * Open a webpage with indicated http url
 * //from ww  w.  ja va2 s  .co  m
 * @param context   the application context
 * @param httpUrl   the http url to open
 */
public static void openWebPage(Context context, String httpUrl) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(httpUrl));
    context.startActivity(intent);
}

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);
}

From source file:Main.java

public static void sysCall(Context context, String callTo) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + callTo));
    context.startActivity(intent);
}

From source file:Main.java

public static void dial(Context context, String phoneNum) {
    Intent dial = new Intent(Intent.ACTION_DIAL);
    dial.setData(Uri.parse("tel:" + phoneNum));
    context.startActivity(dial);
}

From source file:Main.java

public static void intentPlaystore(Context context, String url) {
    Uri marketUri = Uri.parse(url);//from   w w w  .  j a  v  a2  s  .c  o m
    Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);
    context.startActivity(marketIntent);
}

From source file:Main.java

public static void gotoActivity(Context ctx, Class<?> c, String s, boolean b) {
    Intent intent = new Intent(ctx, c);
    intent.putExtra(s, b);//from w w  w  . java 2s  .co m
    ctx.startActivity(intent);
    ((Activity) ctx).finish();
}

From source file:Main.java

/**
 * Activity Not Finish Jump with Bundle//w  w  w. jav a 2  s.c  o  m
 */
public static void gotoActivityNotFinishWithBundle(Context context, Class<?> actClass, Bundle bundle) {
    Intent intent = new Intent(context, actClass);
    intent.putExtras(bundle);
    context.startActivity(intent);
}

From source file:Main.java

public static void callText(Context context, String path) {
    Intent intent = new Intent();
    intent.setDataAndType(Uri.fromFile(new File(path)), "text/plain");
    context.startActivity(intent);
}

From source file:Main.java

public static boolean startActivityFromClass(@NonNull final Context context,
        @NonNull final Class<? extends Activity> cls) {
    final Intent i = new Intent(context, cls);
    context.startActivity(i);
    return true;//from ww  w.  j  a va2s  . com
}