Example usage for android.os Bundle getParcelable

List of usage examples for android.os Bundle getParcelable

Introduction

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

Prototype

@Nullable
public <T extends Parcelable> T getParcelable(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:edu.mit.mobile.android.locast.sync.AbsLocastAccountSyncService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {

    Bundle extras = intent.getExtras();
    if (extras == null) {
        extras = new Bundle();
    }//w ww  . j  a  va  2 s  .  co m
    extras.putString(EXTRA_SYNC_URI, intent.getData().toString());

    final Account account = extras.getParcelable(EXTRA_ACCOUNT);

    // TODO make this shortcut the Android sync system.
    ContentResolver.requestSync(account, getAuthority(), extras);

    return START_NOT_STICKY;
}

From source file:li.barter.fragments.LoginFragment.java

/**
 * If an onward intent has been specified, provides that.
 * <p/>//  w w  w  .ja  v a2 s . com
 * Otherwise, just creates a default intent to open the user's profile
 */
private Intent getDefaultOnwardIntent() {

    final Bundle extras = getArguments();

    if (extras != null && extras.containsKey(Keys.ONWARD_INTENT)) {
        return extras.getParcelable(Keys.ONWARD_INTENT);
    } else {
        return null;
    }
}

From source file:com.zzisoo.toylibrary.fragment.ToyListViewFragment.java

@Override
public void onViewStateRestored(Bundle savedInstanceState) {
    super.onViewStateRestored(savedInstanceState);
    if (savedInstanceState != null) {
        Parcelable savedRecyclerLayoutState = savedInstanceState.getParcelable(BUNDLE_RECYCLER_LAYOUT);
        mToyListView.getLayoutManager().onRestoreInstanceState(savedRecyclerLayoutState);
    }//from w w  w  .j a v  a 2  s  .c  o  m

}

From source file:com.quarterfull.newsAndroid.NewsReaderDetailFragment.java

@Override
public void onViewStateRestored(Bundle savedInstanceState) {
    if (savedInstanceState != null)
        layoutManagerSavedState = savedInstanceState.getParcelable(LAYOUT_MANAGER_STATE);
    super.onViewStateRestored(savedInstanceState);
}

From source file:com.ryan.ryanreader.fragments.PostListingFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    // TODO load position/etc?
    super.onCreate(savedInstanceState);

    final Bundle arguments = getArguments();

    subreddit = arguments.getParcelable("subreddit");

    url = General.uriFromString(arguments.getString("url"));

    if (arguments.containsKey("session")) {
        session = UUID.fromString(arguments.getString("session"));
    }//  w  w  w . j av a 2  s  .c o  m

    downloadType = CacheRequest.DownloadType.valueOf(arguments.getString("downloadType"));
}

From source file:com.beesham.popularmovies.DetailsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_details_view, container, false);
    ButterKnife.bind(this, rootView);

    mTrailerList = new ArrayList();
    mReviewsList = new ArrayList();

    mReviewAdapter = new ReviewAdapter(getActivity(), mReviewsList);
    reviewsListView.setAdapter(mReviewAdapter);
    reviewsListView.setEmptyView(emptyReviewsTextView);

    mTrailersAdapter = new TrailersAdapter(getActivity(), mTrailerList);
    trailersListView.setAdapter(mTrailersAdapter);
    trailersListView.setEmptyView(emptyTrailersTextView);
    trailersListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override//  w  w w .ja v  a 2  s  .co  m
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_VIEW);

            String movieBaseYoutubeUrl = getString(R.string.movies_base_youtube_url,
                    ((Trailer) mTrailerList.get(i)).getTrailerKey());

            intent.setData(Uri.parse(movieBaseYoutubeUrl));
            if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
                startActivity(intent);
            }
        }
    });

    favoriteButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (checkForFavorite()) {
                removeFavorite();
                favoriteButton.setText(R.string.mark_favorite);
            } else {
                insertFavoriteMovie();
                favoriteButton.setText(R.string.mark_unfavorite);
            }
        }
    });

    Bundle args = getArguments();
    if (args != null) {
        mUri = args.getParcelable(DetailsFragment.DETAIL_URI);
    }

    if (savedInstanceState != null && args.containsKey(DetailsFragment.DETAIL_URI)) {
        mUri = args.getParcelable(DetailsFragment.DETAIL_URI);
    }

    return rootView;
}

From source file:com.zd.vpn.fragments.AboutFragment.java

private void triggerBuy(String sku) {
    try {/*from w  ww  . ja  v  a  2 s . c o m*/
        Bundle buyBundle = mService.getBuyIntent(3, getActivity().getPackageName(), sku, INAPPITEM_TYPE_INAPP,
                "Thanks for the donation! :)");

        if (buyBundle.getInt(RESPONSE_CODE) == BILLING_RESPONSE_RESULT_OK) {
            PendingIntent buyIntent = buyBundle.getParcelable(RESPONSE_BUY_INTENT);
            getActivity().startIntentSenderForResult(buyIntent.getIntentSender(), DONATION_CODE, new Intent(),
                    0, 0, 0);
        }

    } catch (RemoteException e) {
        VpnStatus.logException(e);
    } catch (IntentSender.SendIntentException e) {
        VpnStatus.logException(e);
    }
}

From source file:it.scoppelletti.mobilepower.widget.DateControl.java

protected void onRestoreInstanceState(Bundle savedInstanceState) {
    myDialogTag = savedInstanceState.getString(DateControl.STATE_DIALOGTAG);
    myIsEmptyAllowed = savedInstanceState.getBoolean(DateControl.STATE_ISEMPTYALLOWED, true);
    myIsResetEnabled = savedInstanceState.getBoolean(DateControl.STATE_ISRESETENABLED, false);
    setValue((SimpleDate) savedInstanceState.getParcelable(DateControl.STATE_VALUE));
    myValueControl.setError(savedInstanceState.getCharSequence(DateControl.STATE_ERROR));
}

From source file:com.audiokernel.euphonyrmt.fragments.SongsFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        init((Album) savedInstanceState.getParcelable(EXTRA_ALBUM));
    }/*from   ww  w  .  j a v  a2 s.  c  om*/
}