Example usage for android.content Intent setFlags

List of usage examples for android.content Intent setFlags

Introduction

In this page you can find the example usage for android.content Intent setFlags.

Prototype

public @NonNull Intent setFlags(@Flags int flags) 

Source Link

Document

Set special flags controlling how this intent is handled.

Usage

From source file:gov.nasa.arc.geocam.talk.UIUtils.java

/**
 * Go to the {@link SettingsActivity} activity.
 *
 * @param context the context// w  w w  .j  a  v  a  2  s.  c o  m
 */
public static void goToSettings(Context context) {
    final Intent intent = new Intent(context, SettingsActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:Main.java

public static void shareToOtherApp(Context context, String title, String content, String dialogTitle) {
    Intent intentItem = new Intent(Intent.ACTION_SEND);
    intentItem.setType("text/plain");
    intentItem.putExtra(Intent.EXTRA_SUBJECT, title);
    intentItem.putExtra(Intent.EXTRA_TEXT, content);
    intentItem.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(Intent.createChooser(intentItem, dialogTitle));
}

From source file:Main.java

public static void openAppSettings(Context context) {
    Intent myAppSettings = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
            Uri.parse("package:" + context.getPackageName()));
    myAppSettings.addCategory(Intent.CATEGORY_DEFAULT);
    myAppSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(myAppSettings);
}

From source file:gov.nasa.arc.geocam.talk.UIUtils.java

/**
 * Invoke "home" action, returning to {@link GeoCamTalkActivity}.
 *
 * @param context The activity context to send the intent from.
 *//*from w w w  .j a  va  2  s.co m*/
public static void goHome(Context context) {
    final Intent intent = new Intent(context, GeoCamTalkActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:gov.nasa.arc.geocam.talk.UIUtils.java

/**
 * Show the {@link GeoCamTalkMapActivity} for a given message.
 *
 * @param context The current activity context
 * @param talkMessage The {@link GeoCamTalkMessage} that the map activity will display
 *//*  www.  ja v  a 2s .co  m*/
public static void showMapView(Context context, GeoCamTalkMessage talkMessage) {
    final Intent intent = new Intent(context, GeoCamTalkMapActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.putExtra(context.getString(R.string.latitude), talkMessage.getLatitude());
    intent.putExtra(context.getString(R.string.longitude), talkMessage.getLongitude());
    intent.putExtra(context.getString(R.string.accuracy), talkMessage.getAccuracy());
    context.startActivity(intent);
}

From source file:gov.nasa.arc.geocam.talk.UIUtils.java

/**
 * Go to the {@link GeoCamTalkCreateActivity} activity to create a new GeoCam Talk Message.
 *
 * @param context The activity context to send the intent from.
 *//*from w  w w .  j a v  a  2  s  . c o m*/
public static void createTalkMessage(Context context) {
    final Intent intent = new Intent(context, GeoCamTalkCreateActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:Main.java

public static Intent getInstallIntent(File apkFile) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(apkFile.getAbsolutePath())),
            "application/vnd.android.package-archive");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}

From source file:Main.java

public static void applyPermission(Context context) {
    Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC");
    intent.setClassName("com.meizu.safe", "com.meizu.safe.security.AppSecActivity");
    intent.putExtra("packageName", context.getPackageName());
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from  w  w  w .  j  a v  a2 s .  co  m
}

From source file:com.samknows.measurement.util.LoginHelper.java

public static void openMainScreen(Activity acc) {
    Intent intent = new Intent(acc, SamKnowsAggregateStatViewerActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    acc.startActivity(intent);/*from ww w  . j  a  v a 2 s.c o  m*/
    acc.finish();
}

From source file:Main.java

public static void sendSchemeForResult(Activity activity, String url, int requestCode, Bundle bundle,
        int flag) {
    Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url));
    if (bundle != null) {
        intent.putExtras(bundle);//  w w w .j  av  a 2 s.  com
    }

    if (flag != 0) {
        intent.setFlags(flag);
    }

    activity.startActivityForResult(intent, requestCode);
}