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 startActivityInSameTask(@NonNull Context context, @NonNull Class className) {
    Intent intent = new Intent(context, className);
    context.startActivity(intent);
}

From source file:Main.java

public static void launchActivity(Context context, Class<?> activity) {
    Intent intent = new Intent(context, activity);
    context.startActivity(intent);
}

From source file:Main.java

public static void startActivity(Context context, Class<? extends Activity> activityClass, Intent intent) {
    intent.setClass(context, activityClass);
    context.startActivity(intent);
}

From source file:Main.java

public static void IntentWebPage(Context context, String url) {
    Uri uri = Uri.parse(url);/* w  w  w  . j av  a2 s  . c  o  m*/
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(it);
}

From source file:Main.java

public static void openUrl(Context context, String url) {
    Uri uri = Uri.parse(url);/*  www  .  ja v a 2s.com*/
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(intent);
}

From source file:Main.java

public static void openDownloadWeb(Context context, String url) {
    Uri uri = Uri.parse(url);//from  w  w w.j a va 2s  .c om
    Intent it = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(it);
}

From source file:Main.java

public static void sair(Intent intent, Context context) {
    intent.addCategory(Intent.CATEGORY_HOME);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(intent);
}

From source file:Main.java

public static void startSettingIntent(Context context, Intent intent) {
    try {/*from   w ww.  j a v a 2 s .  com*/
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    } catch (Exception e) {
        intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.parse("package:" + context.getPackageName()));
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }
}

From source file:Main.java

public static void turnToActivity(Context context, Class activityClass) {
    Intent intent = new Intent();
    intent.setClass(context, activityClass);
    context.startActivity(intent);
}

From source file:Main.java

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