Intent setFlags - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Intent setFlags method.

This code example shows how to use the following methods:setFlags
        return false; 
    } 
 
    void startCallActivity() { 
        sendCloseSystemWindows(); 
        Intent intent = new Intent(Intent.ACTION_CALL_BUTTON);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        try { 
            mContext.startActivity(intent);
        } catch (ActivityNotFoundException e) {
            Slog.w(TAG, "No activity found for android.intent.action.CALL_BUTTON.");
        } 
    } 
 
    SearchManager getSearchManager() {
        if (mSearchManager == null) {
            mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
        } 
        return mSearchManager;
    } 
7
CodeRank
This code example shows how to use the following methods:putExtra, setFlags
	} 
 
	public static Intent createOpenCalendarEventIntent(int eventId, DateTime from, DateTime to) {
		Intent intent = createCalendarIntent(Intent.ACTION_VIEW);
		intent.setData(ContentUris.withAppendedId(Events.CONTENT_URI, eventId));
		intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, from.getMillis());
		intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, to.getMillis());
		return intent;
	} 
 
	private static Intent createCalendarIntent(String action) {
		Intent intent = new Intent(action);
		intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
				| Intent.FLAG_ACTIVITY_CLEAR_TOP);
		return intent;
	} 
 
	public static Intent createNewEventIntent() {
		DateTime beginTime = new DateTime().plusHours(1).withMinuteOfHour(0).withSecondOfMinute(0)
				.withMillisOfSecond(0); 
7
CodeRank
This code example shows how to use the following methods:setFlags
        return super.onOptionsItemSelected(item);
    } 
 
    public void returnHome() { 
        finish(); 
        Intent i = new Intent(this, ForumsIndexActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(i);
    } 
} 
7
CodeRank
This code example shows how to use the following methods:setClassName, setFlags
    @Override 
    public void onStart() { 
        super.onStart(); 
        // First start the activity we are instrumenting -- the contacts 
        // list. 
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setClassName(getTargetContext(),
                "com.android.phone.Dialer"); 
        Activity activity = startActivitySync(intent);
 
        // This is the Activity object that was started, to do with as we want. 
        Log.i("ContactsSelectInstrumentation", "Started: " + activity);
 
        // Monitor for the expected start activity call. 
        ActivityMonitor am = addMonitor(IntentFilter.create(
            Intent.ACTION_VIEW, ContactsContract.Contacts.CONTENT_ITEM_TYPE), null, true);
 
        // We are going to enqueue a couple key events to simulate the user 
        // selecting an item in the list. 
7
CodeRank
This code example shows how to use the following methods:setFlags
 
public class TestBroadcastReceiver extends BroadcastReceiver {
 
	@Override 
	public void onReceive(final Context context, final Intent intent) {
		final Intent test_intent = new Intent(context, TestActivity.class);
		test_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		context.startActivity(test_intent);
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:setClassName, setFlags
        final String settingsActivity = imi.getSettingsActivity(); 
        if (!TextUtils.isEmpty(settingsActivity)) { 
            settingsIcon.setOnClickListener(new View.OnClickListener() { 
                @Override 
                public void onClick(View arg0) { 
                    Intent intent = new Intent(Intent.ACTION_MAIN); 
                    intent.setClassName(imi.getPackageName(), settingsActivity); 
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK 
                            | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED 
                            | Intent.FLAG_ACTIVITY_CLEAR_TOP); 
                    startActivity(intent); 
                    closePanel(true); 
                } 
            }); 
        } else { 
            // Do not show the settings icon if the IME does not have a settings preference 
            view.findViewById(R.id.item_vertical_separator).setVisibility(View.GONE); 
            settingsIcon.setVisibility(View.GONE); 
        } 
        mRadioViewAndImiMap.put( 
7
CodeRank
This code example shows how to use the following methods:setFlags
	} 
 
	@Kroll.setProperty @Kroll.method 
	public void setFlags(int flags)
	{ 
		intent.setFlags(flags);
	} 
 
	@Kroll.getProperty @Kroll.method 
	public int getFlags() 
	{ 
		return intent.getFlags();
	} 
 
	@Kroll.method 
	public void putExtraUri(String key, String uri)
	{ 
		intent.putExtra(key, Uri.parse(uri));
	} 
 
6
CodeRank
This code example shows how to use the following methods:setFlags
            // The help url string exists, so first add in some extra query parameters. 
            final Uri fullUri = uriWithAddedParameters(context, Uri.parse(helpUrlString));
 
            // Then, create an intent that will be fired when the user 
            // selects this help menu item. 
            Intent intent = new Intent(Intent.ACTION_VIEW, fullUri);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
 
            // Set the intent to the help menu item, show the help menu item in the overflow 
            // menu, and make it visible. 
            helpMenuItem.setIntent(intent);
            helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
            helpMenuItem.setVisible(true);
 
            // return that the help menu item is visible (i.e., true) 
            return true; 
        } 
    } 
 
7
CodeRank
This code example shows how to use the following methods:addCategory, setFlags
 
public final class IntentHelper { 
    private static final String TAG = IntentHelper.class.getSimpleName();
 
    public static Intent getLauncherIntent() {
        final Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addCategory(Intent.CATEGORY_HOME);
        return intent;
    } 
 
    public static void goHomePage(final Context context, final int page) {
        final Intent intent = new Intent(context, HomePage.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra(Constants.EXTRA_PAGE, page);
        context.startActivity(intent);
    } 
 
    public static void goLoginPage(final Context context) {
        final Intent intent = new Intent(context, LoginPage.class);
7
CodeRank
This code example shows how to use the following methods:startActivitySync, getFlags, setFlags
        instrumentation.sendStringSync("s");
        poseForScreenshotNamed("ConfigureMorseActivity-SOS"); 
    } 
 
    private <T extends Activity> T startActivitySync(Class<T> clazz) {
        Intent intent = new Intent(getInstrumentation().getTargetContext(), clazz);
        intent.setFlags(intent.getFlags() | FLAG_ACTIVITY_NEW_TASK);
        return (T) getInstrumentation().startActivitySync(intent);
    } 
 
} 
8
CodeRank

Related Intent setFlags Questions & Answers:

Other Intent setFlags Examples

98:	        Intent notificationIntent = new Intent(context, MainActivity.class);
99:	        // set intent so it does not start a new activity
100:	        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
101:	                Intent.FLAG_ACTIVITY_SINGLE_TOP);
102:	        PendingIntent intent =

Read More

70:				
71:				// Add new Flag to start new Activity
72:				i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
73:				
74:				// Staring Login Activity
-
109:			
110:			// Add new Flag to start new Activity
111:			i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
112:			
113:			// Staring Login Activity

Read More

12:			
13:			// Add new Flag to start new Activity
14:			i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
15:			
16:			// Staring Login Activity

Read More

setFlags Method Overview
Set special flags controlling how this intent is handled.
See Code Examples for other Android Intent Methods: