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:com.bluros.music.utils.NavigationUtils.java

public static void navigateToSearch(Activity context) {
    final Intent intent = new Intent(context, SearchActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.setAction(Constants.NAVIGATE_SEARCH);
    context.startActivity(intent);
}

From source file:com.agna.setmaster.ui.screen.profile.ProfileActivity.java

public static void start(Activity activity, Profile profile) {
    Intent i = new Intent(activity, ProfileActivity.class);
    i.putExtra(EXTRA_PROFILE, profile);/* ww w  . jav  a  2  s . co m*/
    i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    activity.startActivity(i);
}

From source file:Main.java

public static void toActivity(final Activity context, final Intent intent, final int requestCode,
        final boolean showAnimation) {
    if (context == null || intent == null) {
        return;/*w w  w  .j a  v  a 2  s.c o  m*/
    }
    context.runOnUiThread(new Runnable() {
        @Override
        public void run() {

            if (requestCode < 0) {
                context.startActivity(intent);
            } else {
                context.startActivityForResult(intent, requestCode);
            }
            //            if (showAnimation) {
            //               context.overridePendingTransition(R.anim.right_push_in, R.anim.hold);
            //            } else {
            //               context.overridePendingTransition(R.anim.null_anim, R.anim.null_anim);
            //            }
        }
    });
}

From source file:com.johnny.gank.ui.activity.WebviewActivity.java

public static void openUrl(Activity activity, String url, String title) {
    Intent intent = new Intent(activity, WebviewActivity.class);
    intent.putExtra(EXTRA_URL, url);
    intent.putExtra(EXTRA_TITLE, title);
    activity.startActivity(intent);
}

From source file:com.j1024.mcommon.support.GenericFragmentActivity.java

public static void start(Activity from, Class<?> fragmentClass, Bundle args) {
    if (Safeguard.ignorable(from))
        return;/*  www  .ja  va  2 s .  c  om*/

    Intent intent = new Intent(from, GenericFragmentActivity.class);
    intent.putExtra(KEY_FRAGMENT_CLASS, fragmentClass.getCanonicalName());
    intent.putExtra(KEY_FRAGMENT_ARGS, args);
    from.startActivity(intent);
}

From source file:Main.java

public static void openActivity(Activity activity, String pAction, Bundle pBundle, int requestCode) {
    if (null == activity)
        return;//from  w  w  w  . j  av a  2s .c  om

    Intent intent = new Intent(pAction);
    if (pBundle != null) {
        intent.putExtras(pBundle);
    }

    if (requestCode < 0) {
        activity.startActivity(intent);
    } else {
        activity.startActivityForResult(intent, requestCode);
    }
}

From source file:gr.scify.newsum.Utils.java

/**
 * Set the theme of the Activity, and restart it by creating a new Activity
 * of the same type.//from  w  w  w .  ja  v a2 s.c om
 */
public static void changeToTheme(Activity activity, int theme) {
    sTheme = theme;
    activity.finish();

    activity.startActivity(new Intent(activity, activity.getClass()));
}

From source file:com.yutong.axxc.parents.view.common.ActivityUtils.java

/**
 * @param vMonitorBatchActivity TODO/*from w  w w  .j a  v  a  2s . c  om*/
 * @param from ?activity
 * @param to biactivity
 * @param vBeanList ??
 */
public static void changeActivityWithData(Activity from, Class<?> to, Intent mIntent) {
    if (mIntent != null) {
        mIntent.setClass(from, to);
        from.startActivity(mIntent);
    }
}

From source file:com.ofalvai.bpinfo.util.UiUtils.java

/**
 * Opens a Chrome custom tab styled to the application's theme
 * @param activity  Used for context and launching fallback intent
 * @param url   URL to open//from w w w .j a v  a2s . c om
 */
public static void openCustomTab(Activity activity, Uri url) {
    String packageName = CustomTabsHelper.getPackageNameToUse(activity);

    if (packageName == null) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(url);
        activity.startActivity(intent);
    } else {
        CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
        int color = ContextCompat.getColor(activity, R.color.colorPrimary);
        intentBuilder.setToolbarColor(color);

        CustomTabsIntent customTabsIntent = intentBuilder.build();
        customTabsIntent.intent.setPackage(packageName);
        customTabsIntent.launchUrl(activity, url);
    }
}

From source file:ru.appsm.inapphelp.IAHHelpDesk.java

/**
 *
 * Starts a Help activity. It shows all FAQ and also let user report new issue if not found in FAQ.
 *
 * @param activity//from w w  w  .j a va2s . co  m
 */
public static void showHelp(Activity activity) {
    if (singletonInstance != null) {
        activity.startActivity(new Intent(activity, HomeActivity.class));
    } else {
        Log.e(TAG, "Inapphelp not inited");
    }
}