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 startActivity(Context c, Class clz, boolean ifFinish) {
    Intent intent = new Intent(c, clz);
    c.startActivity(intent);
    if (ifFinish) {
        ((Activity) c).finish();/*from  w  ww .  ja v  a2  s  .  c o  m*/
    }

}

From source file:Main.java

/**
 * Start an activity related to the <tt>uri</tt>
 * @param uri the intent uri/*from w ww  .j a v a2  s  . c om*/
 * @param context current context
 */
public static void openUri(Uri uri, Context context) {
    Intent intent = getIntentOfUri(uri);
    context.startActivity(intent);
}

From source file:Main.java

public static void openAppList(Context mContext) {
    Intent intent = new Intent(Settings.ACTION_APPLICATION_SETTINGS);
    mContext.startActivity(intent);
}

From source file:Main.java

public static boolean startActivity(Context context, Intent intent) {
    if (isValid(context, intent)) {
        context.startActivity(intent);
        return true;
    }/*from  w  ww  .  ja va2s  . com*/
    return false;
}

From source file:Main.java

public static void showInputMethodSettingsPage(Context context) {
    Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS);
    context.startActivity(intent);
}

From source file:Main.java

@SuppressWarnings("rawtypes")
public static void startActivity(Context context, Class cls) {
    Intent intent = new Intent(context, cls);
    context.startActivity(intent);
}

From source file:Main.java

public static void openWirelessSettings(Context context) {
    if (android.os.Build.VERSION.SDK_INT > 10) {
        context.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
    } else {/*from ww  w .j a  v a2  s.c  o m*/
        context.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
    }
}

From source file:Main.java

public static void openActivity(Context context, Class newActivity) {
    Intent intent = new Intent(context, newActivity);
    context.startActivity(intent);
    //        intent.putExtra(SimpleBackActivity.BUNDLE_KEY_PAGE, page.getValue());
}

From source file:Main.java

public static void startActivity(Context context, Intent intent) {
    try {/*from   w  w  w .j a  v  a 2 s  . c o m*/
        context.startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void dowloadBySystem(Context context, String url) {
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    context.startActivity(i);
}