Example usage for android.app Activity startActivity

List of usage examples for android.app Activity startActivity

Introduction

In this page you can find the example usage for android.app Activity startActivity.

Prototype

@Override
public void startActivity(Intent intent) 

Source Link

Document

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

Usage

From source file:Main.java

public static void start_new_activity(Activity activity, Class<?> mclass, boolean is_finish_parent) {
    Intent myintent = new Intent(activity, mclass);
    activity.startActivity(myintent);
    if (is_finish_parent)
        activity.finish();//from  w  w  w  .j a v  a 2s  .  c  o m
}

From source file:Main.java

/**
 * Opens the device's browser to the passed url
 * @param activity the calling activity//from  ww w.ja va  2s.  co  m
 * @param url the url to view
 */
public static void openBrowser(Activity activity, String url) {
    final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    activity.startActivity(Intent.createChooser(browserIntent, null));
}

From source file:Main.java

public static void simplyNavigateTo(Class activityToNavigateTo, Activity activityToNavigateFrom) {
    Intent navigationIntent = new Intent(activityToNavigateFrom, activityToNavigateTo);
    activityToNavigateFrom.startActivity(navigationIntent);
}

From source file:Main.java

public static void skip(Activity aty, Class clazz) {
    if (aty == null || clazz == null)
        return;//  w  w w. j  av  a  2  s . c o m
    aty.startActivity(new Intent(aty.getApplicationContext(), clazz));
}

From source file:Main.java

public static void skip(Activity aty, Intent intent) {
    if (aty == null || intent == null)
        return;//from w  w w .  ja  v  a  2 s .  com
    aty.startActivity(intent);
}

From source file:Main.java

public static void IntentNetWorkSetting(Activity activity) {
    try {/*from  w  ww  .  j av  a  2s  . com*/
        Intent wifiSettingsIntent = new Intent("android.settings.WIFI_SETTINGS");
        activity.startActivity(wifiSettingsIntent);
    } catch (Exception ignored) {
    }
}

From source file:Main.java

public static void openUrl(Context cotx, String url) {
    Activity act = (Activity) cotx;
    Uri uri = Uri.parse(url);//from w ww  .  j  a v a2  s.  co m
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    act.startActivity(intent);
}

From source file:Main.java

public static void forwardToDial(Activity activity, String phoneNumber) {
    if (activity != null && !TextUtils.isEmpty(phoneNumber)) {
        activity.startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber)));
    }/*from w  w w .  j  ava2s .c o m*/
}

From source file:Main.java

public static void enterActivityWithBundle(Activity activity, Class clz, Bundle bundle) {
    Intent intent = new Intent(activity, clz);
    intent.putExtras(bundle);// w w  w  .  jav  a2s  .  co m
    activity.startActivity(intent);
}

From source file:Main.java

public static void startActivity(Activity activity, Class clazz, int flags) {
    Intent intent = new Intent(activity, clazz);
    intent.addFlags(flags);//  ww w.  jav a  2  s .  c om
    activity.startActivity(intent);
}