Example usage for android.app Activity getIntent

List of usage examples for android.app Activity getIntent

Introduction

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

Prototype

public Intent getIntent() 

Source Link

Document

Return the intent that started this activity.

Usage

From source file:edu.stanford.junction.android.AndroidJunctionMaker.java

public static Junction newJunction(Activity a, JunctionActor actor) throws JunctionException {
    return newJunction(a.getIntent(), actor);
}

From source file:com.nextgis.mobile.fragment.SettingsFragment.java

public static void initializeTheme(final Activity activity, final ListPreference theme) {
    if (null != theme) {
        theme.setSummary(theme.getEntry());

        theme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            @Override//from  w  w w.jav  a2  s. c o  m
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                activity.startActivity(activity.getIntent());
                activity.finish();
                return true;
            }
        });
    }
}

From source file:com.ruesga.rview.misc.ActivityHelper.java

public static boolean performFinishActivity(Activity activity, boolean forceNavigateUp) {
    if (activity == null) {
        return false;
    }/*from  w w w. ja  v  a 2 s  . c o m*/
    boolean hasParent = activity.getIntent().getBooleanExtra(Constants.EXTRA_HAS_PARENT, false);
    if (forceNavigateUp || !hasParent) {
        Intent upIntent = NavUtils.getParentActivityIntent(activity);
        if (upIntent != null) {
            if (NavUtils.shouldUpRecreateTask(activity, upIntent)) {
                TaskStackBuilder.create(activity).addNextIntentWithParentStack(upIntent).startActivities();
                activity.finish();
            } else {
                NavUtils.navigateUpTo(activity, upIntent);
            }
            return true;
        }
    }
    activity.finish();
    return true;
}

From source file:com.facebook.notifications.NotificationsManager.java

/**
 * Present a card from the notification this activity
 * was created from, if the notification exists.
 *
 * @param activity The activity to present from.
 * @return Whether or not a card was presented.
 *//*from w w  w  .  j  a  v a2s. c  om*/
public static boolean presentCardFromNotification(@NonNull Activity activity) {
    return presentCardFromNotification(activity, activity.getIntent());
}

From source file:mobisocial.musubi.BootstrapActivity.java

/**
 * finishes the caller if bootstrapping is necessary
 * @param activity//w  ww  .ja  va  2  s .  c  om
 * @return true if the bootstrap activity will be started
 */
public static boolean bootstrapIfNecessary(Activity activity) {
    if (sBootstrapped) {
        return false;
    }
    Intent intent = new Intent(activity, BootstrapActivity.class);
    intent.putExtra(EXTRA_ORIGINAL_INTENT, (Parcelable) activity.getIntent());
    intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
    activity.startActivity(intent);
    activity.finish();
    return true;
}

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

public static void setPickerFragmentAccountType(Activity activity, ContactEntryListFragment<?> listFragment) {
    if (listFragment instanceof ContactPickerFragment) {
        ContactPickerFragment fragment = (ContactPickerFragment) listFragment;
        int accountTypeShow = activity.getIntent().getIntExtra(ContactsSettingsUtils.ACCOUNT_TYPE,
                ContactsSettingsUtils.ALL_TYPE_ACCOUNT);
        Log.d(TAG, "[setPickerFragmentAccountType]accountTypeShow:" + accountTypeShow);
        fragment.setAccountType(accountTypeShow);
    }//  w ww .j ava  2 s  .  c  o  m
}

From source file:com.eurotong.orderhelperandroid.Common.java

public static Table GetTableFromIntent(Activity activity) {
    Table table = null;/*  w  ww .j av  a 2 s  . co  m*/
    Bundle extras = activity.getIntent().getExtras();
    if (extras != null) {
        String tablenr = extras.getString(Define.TABLE_NR);
        if (tablenr != null && tablenr != "") {
            table = TableHelper.GetTableByNumber(tablenr);
        }
    }
    return table;
}

From source file:com.chrynan.teleport.Teleport.java

/**
 * Retrieves and stores data into their corresponding fields within the specified binding object.
 * Uses the Activity as both the binding object and the Context. First checks the Activity for
 * an Intent (via the getIntent() method), if this Intent is not null it will attempt to use
 * it as the storage mechanism. Otherwise it will use the default storage mechanism using the Context.
 *
 * @param activity The Activity object that acts as both the binding object and the Context.
 *///  ww  w. j  a va 2  s .  c o  m
public static final void bind(@NonNull Activity activity) {
    if (activity == null) {
        throw new IllegalArgumentException("Activity parameter in bind method of "
                + Teleport.class.getSimpleName() + " class must not be null.");
    }
    if (activity.getIntent() != null) {
        bind(activity, activity, activity.getIntent());
    } else {
        bind(activity, activity);
    }
}

From source file:com.amaze.carbonfilemanager.fragments.preference_fragments.Preffrag.java

public static void restartPC(final Activity activity) {
    if (activity == null)
        return;/* www . j  a v  a  2s .  c o  m*/

    final int enter_anim = android.R.anim.fade_in;
    final int exit_anim = android.R.anim.fade_out;
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.finish();
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.startActivity(activity.getIntent());
}

From source file:com.google.samples.apps.iosched.util.UIUtils.java

/**
 * If an activity's intent is for a Google I/O web URL that the app can handle natively, this
 * method translates the intent to the equivalent native intent.
 *//*from   www. ja v a  2s  . c o  m*/
public static void tryTranslateHttpIntent(Activity activity) {
    Intent intent = activity.getIntent();
    if (intent == null) {
        return;
    }

    Uri uri = intent.getData();
    if (uri == null || TextUtils.isEmpty(uri.getPath())) {
        return;
    }

    Uri sessionDetailWebUrlPrefix = Uri.parse(Config.SESSION_DETAIL_WEB_URL_PREFIX);
    String prefixPath = sessionDetailWebUrlPrefix.getPath();
    String path = uri.getPath();

    if (sessionDetailWebUrlPrefix.getScheme().equals(uri.getScheme())
            && sessionDetailWebUrlPrefix.getHost().equals(uri.getHost()) && path.startsWith(prefixPath)) {
        String sessionId = path.substring(prefixPath.length());
        activity.setIntent(
                new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSessionUri(sessionId)));
    }
}