Example usage for android.os Bundle getLong

List of usage examples for android.os Bundle getLong

Introduction

In this page you can find the example usage for android.os Bundle getLong.

Prototype

public long getLong(String key, long defaultValue) 

Source Link

Document

Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

Usage

From source file:Main.java

public static Date getDate(Bundle bundle, String key) {
    if (bundle == null) {
        return null;
    }/*from   ww w  . j ava2s  .  c o  m*/

    long n = bundle.getLong(key, INVALID_BUNDLE_MILLISECONDS);
    if (n == INVALID_BUNDLE_MILLISECONDS) {
        return null;
    }

    return new Date(n);
}

From source file:Main.java

static Date getDate(Bundle bundle, String key) {
    if (bundle == null) {
        return null;
    }/*from  w ww.j a va2  s  .com*/

    long n = bundle.getLong(key, INVALID_BUNDLE_MILLISECONDS);
    if (n == INVALID_BUNDLE_MILLISECONDS) {
        return null;
    }

    return new Date(n);
}

From source file:Main.java

public static boolean hasTokenInformation(Bundle bundle) {
    if (bundle == null) {
        return false;
    }/*from   w  w  w.  ja  va  2s.c o  m*/

    String token = bundle.getString(TOKEN_KEY);
    if ((token == null) || (token.length() == 0)) {
        return false;
    }

    long expiresMilliseconds = bundle.getLong(EXPIRATION_DATE_KEY, 0L);
    if (expiresMilliseconds == 0L) {
        return false;
    }

    return true;
}

From source file:com.nononsenseapps.feeder.ui.ReaderFragment.java

public static FeedItemSQL RssItemFromBundle(Bundle bundle) {
    FeedItemSQL rssItem = new FeedItemSQL();
    rssItem.id = bundle.getLong(ARG_ID, -1);
    rssItem.title = bundle.getString(ARG_TITLE);
    rssItem.description = (bundle.getString(ARG_DESCRIPTION));
    rssItem.link = (bundle.getString(ARG_LINK));
    rssItem.enclosurelink = (bundle.getString(ARG_ENCLOSURE));
    rssItem.imageurl = (bundle.getString(ARG_IMAGEURL));
    rssItem.author = (bundle.getString(ARG_AUTHOR));
    rssItem.setPubDate(bundle.getString(ARG_DATE));
    rssItem.feedtitle = (bundle.getString(ARG_FEEDTITLE));
    return rssItem;
}

From source file:com.dwdesign.tweetings.fragment.UserBlocksListFragment.java

@Override
public Loader<List<ParcelableUser>> newLoaderInstance() {
    final Bundle args = getArguments();
    long account_id = -1, max_id = -1;
    if (args != null) {
        account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1);
        max_id = args.getLong(INTENT_KEY_MAX_ID, -1);
    }/*from   w  ww.  j  a  v  a  2 s  .c  o m*/
    return new UserBlocksLoader(getActivity(), account_id, max_id, getData());
}

From source file:de.vanita5.twittnuker.fragment.support.RetweetsOfMeFragment.java

@Override
public Loader<List<ParcelableStatus>> newLoaderInstance(final Context context, final Bundle args) {
    if (args == null)
        return null;
    final long account_id = args.getLong(EXTRA_ACCOUNT_ID, -1);
    final long max_id = args.getLong(EXTRA_MAX_ID, -1);
    final long since_id = args.getLong(EXTRA_SINCE_ID, -1);
    final int tab_position = args.getInt(EXTRA_TAB_POSITION, -1);
    return new RetweetsOfMeLoader(context, account_id, max_id, since_id, getData(), getSavedStatusesFileArgs(),
            tab_position);/*from  w  w w.  j  av  a  2 s  .c om*/
}

From source file:de.vanita5.twittnuker.fragment.support.StatusesSearchFragment.java

@Override
public Loader<List<ParcelableStatus>> onCreateStatusesLoader(final Context context, final Bundle args,
        final boolean fromUser) {
    setRefreshing(true);//from   w  w w  .j  a v a2  s . com
    final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
    final long maxId = args.getLong(EXTRA_MAX_ID, -1);
    final long sinceId = args.getLong(EXTRA_SINCE_ID, -1);
    final String query = args.getString(EXTRA_QUERY);
    final int tabPosition = args.getInt(EXTRA_TAB_POSITION, -1);
    return new TweetSearchLoader(getActivity(), accountId, query, sinceId, maxId, getAdapterData(),
            getSavedStatusesFileArgs(), tabPosition, fromUser);
}

From source file:com.dwdesign.tweetings.fragment.UserListSubscribersFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        mCursor = savedInstanceState.getLong(INTENT_KEY_PAGE, -1);
    }/*from  ww  w.  ja va 2  s  .  co m*/
    super.onActivityCreated(savedInstanceState);
}

From source file:de.vanita5.twittnuker.fragment.support.StatusRepliesListFragment.java

@Override
public Loader<List<ParcelableStatus>> newLoaderInstance(final Context context, final Bundle args) {
    if (args == null)
        return null;
    final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
    final String screenName = args.getString(EXTRA_SCREEN_NAME);
    final long statusId = args.getLong(EXTRA_STATUS_ID, -1);
    if (accountId <= 0 || statusId <= 0 || screenName == null)
        return null;
    final long maxId = args.getLong(EXTRA_MAX_ID, -1);
    final long sinceId = args.getLong(EXTRA_SINCE_ID, -1);
    final int tabPosition = args.getInt(EXTRA_TAB_POSITION, -1);
    getListAdapter().setMentionsHightlightDisabled(
            objectEquals(getAccountScreenName(getActivity(), accountId), screenName));
    return new StatusRepliesLoader(getActivity(), accountId, screenName, statusId, maxId, sinceId, getData(),
            getSavedStatusesFileArgs(), tabPosition);
}

From source file:de.vanita5.twittnuker.fragment.support.StatusRepliesListFragment.java

@Override
protected String[] getSavedStatusesFileArgs() {
    final Bundle args = getArguments();
    if (args == null)
        return null;
    final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
    final String screenName = args.getString(EXTRA_SCREEN_NAME);
    final long statusId = args.getLong(EXTRA_STATUS_ID);
    return new String[] { AUTHORITY_STATUS_REPLIES, "account" + accountId, "screen_name" + screenName,
            "status_id" + statusId };
}