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.xiaomi.account.utils.SysHelper.java

public static void goToEmailPage(Activity activity, String url) {
    Intent intent = new Intent("android.intent.action.VIEW");
    intent.setData(Uri.parse(url));//from   www  .  j  a va  2 s . co m
    intent.addFlags(67108864);
    intent.addFlags(268435456);
    intent.addFlags(8388608);
    activity.startActivity(intent);
}

From source file:com.frostwire.android.gui.util.UIUtils.java

public static void goToFrostWireMainActivity(Activity activity) {
    final Intent intent = new Intent(activity, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    activity.startActivity(intent);
    activity.finish();/*from ww w .j  a  va2  s.  com*/
    activity.overridePendingTransition(0, 0);
}

From source file:Main.java

public static void showMessageDialogWithNewIntent(final Activity curentActivity, Context context,
        String message, final Class newActivity, final String extras) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message).setCancelable(false).setPositiveButton("Ok",
            new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int id) {

                    Intent i = new Intent(curentActivity, newActivity);
                    if (extras != null) {
                        Log.i("LOGINSIGNUP", "=extras!=null in showMessageDialog");
                        i.putExtra("OAuthError", true);
                    }//ww w  .  j  ava  2 s  .co  m
                    Log.i("LOGINSIGNUP", "==after if in showMessageDialog");

                    curentActivity.startActivity(i);
                    //                  curentActivity.finish();
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch an Apache II License/*from  w  w w. ja va 2  s. c  o m*/
 *
 * @param activity context
 */
public static void launchAboutActivity(Activity activity) {
    Intent intent = new Intent(Intents.ACTION_VIEW_ABOUT);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
}

From source file:com.xiaomi.account.utils.SysHelper.java

public static void getbackPassword(Activity activity) {
    Intent intent = new Intent("android.intent.action.VIEW");
    intent.setData(Uri.parse(com.xiaomi.account.Constants.PASSWORD_RECOVERY_URL));
    intent.addFlags(67108864);//  w  w  w.ja va2  s . c  om
    intent.addFlags(268435456);
    intent.addFlags(8388608);
    activity.startActivity(intent);
}

From source file:com.qiscus.sdk.util.QiscusPermissionsUtil.java

public static boolean checkDeniedPermissionsNeverAskAgain(Object object, String rationale,
        @StringRes int positiveButton, @StringRes int negativeButton, List<String> deniedPerms) {
    boolean shouldShowRationale;
    for (String perm : deniedPerms) {
        shouldShowRationale = shouldShowRequestPermissionRationale(object, perm);
        if (!shouldShowRationale) {
            final Activity activity = getActivity(object);
            if (null == activity) {
                return true;
            }//w  ww .ja v  a  2s .c o m

            AlertDialog dialog = new AlertDialog.Builder(activity).setMessage(rationale)
                    .setPositiveButton(positiveButton, (dialog1, which) -> {
                        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                        Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
                        intent.setData(uri);
                        activity.startActivity(intent);
                    }).setNegativeButton(negativeButton, null).create();
            dialog.show();

            return true;
        }
    }

    return false;
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch the {@link AddChannelListActivity}.
 *
 * @param activity The context used to start this intent
 *//*from w  w  w .j  a  v  a 2 s . c om*/
public static void launchChannelListActivity(Activity activity) {
    Intent intent = new Intent(Intents.ACTION_ADD_CHANNEL_LIST_VIEW);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
}

From source file:com.mobicage.rogerthat.AbstractHomeActivity.java

public static void startWithLaunchInfo(final Activity activity, final String launchInfo) {
    final Intent intent = new Intent(activity, HomeActivity.class);
    intent.putExtra(INTENT_KEY_LAUNCHINFO, launchInfo);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    activity.startActivity(intent);
}

From source file:Main.java

public static boolean startLastActivity(Activity activity) {
    try {//from  www.ja  v  a2s  . c  om
        BufferedReader reader = new BufferedReader(new InputStreamReader(activity.openFileInput(FILENAME)));
        String nextClassName = reader.readLine();
        reader.close();

        if (null == nextClassName || nextClassName.length() < 3) {
            return false;
        }

        String currClassName = activity.getClass().getName();
        if (currClassName.equals(nextClassName)) {
            return false;
        }

        @SuppressWarnings("unchecked")
        Class<? extends Activity> clazz = (Class<? extends Activity>) Class.forName(nextClassName);
        if (null == clazz) {
            return false;
        }

        Intent i = new Intent(activity, clazz);
        activity.startActivity(i);
        activity.finish();
        reader.close();

        return true;
    } catch (Exception e) {
        Toast.makeText(activity, "startLastActivity: " + e, Toast.LENGTH_LONG).show();
    }
    return false;
}

From source file:com.mediatek.contacts.activities.ActivitiesUtils.java

public static boolean conferenceCall(Activity activity) {
    Log.i(TAG, "[conferenceCall]...");
    final Intent intent = new Intent();
    intent.setClassName(activity, "com.mediatek.contacts.list.ContactListMultiChoiceActivity").setAction(
            com.mediatek.contacts.util.ContactsIntent.LIST.ACTION_PICK_MULTI_PHONEANDIMSANDSIPCONTACTS);
    intent.putExtra(com.mediatek.contacts.util.ContactsIntent.CONFERENCE_SENDER,
            com.mediatek.contacts.util.ContactsIntent.CONFERENCE_CONTACTS);
    activity.startActivity(intent);

    return true;/*from   w w  w.  j  ava2 s .  com*/
}