當前位置: 首頁>>代碼示例>>Java>>正文


Java Bundle.putParcelable方法代碼示例

本文整理匯總了Java中android.os.Bundle.putParcelable方法的典型用法代碼示例。如果您正苦於以下問題:Java Bundle.putParcelable方法的具體用法?Java Bundle.putParcelable怎麽用?Java Bundle.putParcelable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.putParcelable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.os.Bundle; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_profile);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    GitHubUserProfileDataEntry entry = getIntent().getParcelableExtra("profile");
    Log.v(TAG, "entry " + entry.getImageUri());
    getSupportActionBar().setTitle(entry.getName());
    getSupportActionBar().setSubtitle(entry.getLocation());
    UserProfileFragment userProfileFragment = UserProfileFragment.newInstance();
    Bundle bundle = new Bundle();
    bundle.putParcelable("entry", entry);
    userProfileFragment.setArguments(bundle);
    getSupportFragmentManager().beginTransaction().replace(R.id.user_profile_fragment, userProfileFragment).commit();
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
開發者ID:OlgaKuklina,項目名稱:GitJourney,代碼行數:18,代碼來源:UserProfileActivity.java

示例2: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Parcelable p = this.mFragments.saveAllState();
    if (p != null) {
        outState.putParcelable(FRAGMENTS_TAG, p);
    }
    if (this.mPendingFragmentActivityResults.size() > 0) {
        outState.putInt(NEXT_CANDIDATE_REQUEST_INDEX_TAG, this.mNextCandidateRequestIndex);
        int[] requestCodes = new int[this.mPendingFragmentActivityResults.size()];
        String[] fragmentWhos = new String[this.mPendingFragmentActivityResults.size()];
        for (int i = 0; i < this.mPendingFragmentActivityResults.size(); i++) {
            requestCodes[i] = this.mPendingFragmentActivityResults.keyAt(i);
            fragmentWhos[i] = (String) this.mPendingFragmentActivityResults.valueAt(i);
        }
        outState.putIntArray(ALLOCATED_REQUEST_INDICIES_TAG, requestCodes);
        outState.putStringArray(REQUEST_FRAGMENT_WHO_TAG, fragmentWhos);
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:19,代碼來源:FragmentActivity.java

示例3: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
@Override
protected void onSaveInstanceState(Bundle outState) {
    if (mWorkspace.getChildCount() > 0) {
        outState.putInt(RUNTIME_STATE_CURRENT_SCREEN,
                mWorkspace.getCurrentPageOffsetFromCustomContent());

    }
    super.onSaveInstanceState(outState);

    outState.putInt(RUNTIME_STATE, mState.ordinal());
    // We close any open folders and shortcut containers since they will not be re-opened,
    // and we need to make sure this state is reflected.
    AbstractFloatingView.closeAllOpenViews(this, false);

    if (mPendingRequestArgs != null) {
        outState.putParcelable(RUNTIME_STATE_PENDING_REQUEST_ARGS, mPendingRequestArgs);
    }
    if (mPendingActivityResult != null) {
        outState.putParcelable(RUNTIME_STATE_PENDING_ACTIVITY_RESULT, mPendingActivityResult);
    }

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onSaveInstanceState(outState);
    }
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:26,代碼來源:Launcher.java

示例4: writeToParcel

import android.os.Bundle; //導入方法依賴的package包/類
public static Parcel writeToParcel(Parcelable instance, String key) {
    Bundle bundle = new Bundle();
    bundle.putParcelable(key, instance);
    
    Parcel parcel = Parcel.obtain();
    parcel.writeBundle(bundle);
    return parcel;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:ParcelUtils.java

示例5: startServiceWithPlaylist

import android.os.Bundle; //導入方法依賴的package包/類
private void startServiceWithPlaylist(int shuffleMode, Playlist playlist) {
    Intent intent = new Intent(this, MusicService.class);
    intent.setAction(MusicService.ACTION_PLAY_PLAYLIST);

    Bundle bundle = new Bundle();
    bundle.putParcelable(MusicService.INTENT_EXTRA_PLAYLIST, playlist);
    bundle.putInt(MusicService.INTENT_EXTRA_SHUFFLE_MODE, shuffleMode);

    intent.putExtras(bundle);

    startService(intent);
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:13,代碼來源:AppShortcutLauncherActivity.java

示例6: createDocument

import android.os.Bundle; //導入方法依賴的package包/類
public static Uri createDocument(ContentProviderClient client, Uri parentDocumentUri,
                                 String mimeType, String displayName) throws Exception {
    final Bundle in = new Bundle();
    in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri);
    in.putString(DocumentsContract.Document.COLUMN_MIME_TYPE, mimeType);
    in.putString(DocumentsContract.Document.COLUMN_DISPLAY_NAME, displayName);

    final Bundle out = client.call(METHOD_CREATE_DOCUMENT, null, in);
    return out.getParcelable(DocumentsContract.EXTRA_URI);
}
 
開發者ID:gigabytedevelopers,項目名稱:FireFiles,代碼行數:11,代碼來源:DocumentsContract.java

示例7: playFromUri

import android.os.Bundle; //導入方法依賴的package包/類
public void playFromUri(Uri uri, Bundle extras) {
    if (uri == null || Uri.EMPTY.equals(uri)) {
        throw new IllegalArgumentException("You must specify a non-empty Uri for playFromUri.");
    }
    Bundle bundle = new Bundle();
    bundle.putParcelable(MediaSessionCompat.ACTION_ARGUMENT_URI, uri);
    bundle.putParcelable(MediaSessionCompat.ACTION_ARGUMENT_EXTRAS, extras);
    sendCustomAction(MediaSessionCompat.ACTION_PLAY_FROM_URI, bundle);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:10,代碼來源:MediaControllerCompat.java

示例8: getViewAt

import android.os.Bundle; //導入方法依賴的package包/類
@Override
public RemoteViews getViewAt(int position) {
    if (position == MAX_WIDGET_ROWS_LIMIT) {
        return showWidgetItemViewAll();
    }

    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_item_coupon);
    remoteViews.setTextViewText(R.id.text_view_merchant, coupons.get(position).merchant);
    remoteViews.setTextViewText(R.id.text_view_category, coupons.get(position).category);
    remoteViews.setTextViewText(R.id.text_view_valid_until, Utilities.getStringDate(coupons.get(position).validUntil));
    remoteViews.setTextViewText(R.id.text_view_coupon_code, coupons.get(position).couponCode);

    int colorId = R.color.material_orange_900;
    String couponStateText = context.getString(R.string.coupon_state_available);
    if (coupons.get(position).state == 1) {
        colorId = R.color.material_green_700;
        couponStateText = context.getString(R.string.coupon_state_used);
    }
    remoteViews.setTextColor(R.id.text_view_coupon_state, ContextCompat.getColor(context.getApplicationContext(), colorId));
    remoteViews.setTextViewText(R.id.text_view_coupon_state, couponStateText);

    Bundle extras = new Bundle();
    extras.putInt(Constants.COUPON_FRAGMENT_MODE, CouponFragment.Mode.VIEW);
    extras.putParcelable(Constants.COUPON_PARCELABLE, coupons.get(position));
    if (!isTablet) {
        extras.putStringArrayList(Constants.BUNDLE_EXTRA_MERCHANT_SUGGESTIONS, new ArrayList<String>());
        extras.putStringArrayList(Constants.BUNDLE_EXTRA_CATEGORY_SUGGESTIONS, new ArrayList<String>());
    } else {
        extras.putBoolean(Constants.BUNDLE_EXTRA_LOAD_COUPON_FRAGMENT, true);
    }

    Intent fillInIntent = new Intent();
    fillInIntent.putExtras(extras);
    remoteViews.setOnClickFillInIntent(R.id.widget_row, fillInIntent);

    return remoteViews;
}
 
開發者ID:darsh2,項目名稱:CouponsTracker,代碼行數:38,代碼來源:CouponRemoteViewsFactory.java

示例9: saveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
private void saveInstanceState(final Bundle outState) {
    outState.putSerializable("state", state);

    outState.putParcelable("payment_intent", paymentIntent);
    outState.putSerializable("fee_category", feeCategory);
    if (validatedAddress != null)
        outState.putParcelable("validated_address", validatedAddress);

    if (sentTransaction != null)
        outState.putSerializable("sent_transaction_hash", sentTransaction.getHash());
    if (directPaymentAck != null)
        outState.putBoolean("direct_payment_ack", directPaymentAck);
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:14,代碼來源:SendCoinsFragment.java

示例10: createChooser

import android.os.Bundle; //導入方法依賴的package包/類
public static void createChooser(CoordinatorLayout rootView,
                                 ShareChooserDialog.ShareChooserDialogListener listener,
                                 final AppCompatActivity parent,
                                 final Intent shareIntent,
                                 boolean showNearbyItem) {
    ShareChooserDialog d = new ShareChooserDialog();
    d.setListener(listener);
    Bundle args = new Bundle();
    args.putInt(ARG_WIDTH, rootView.getWidth());
    args.putParcelable(ARG_INTENT, shareIntent);
    args.putBoolean(ARG_SHOW_NEARBY, showNearbyItem);
    d.setArguments(args);
    d.show(parent.getSupportFragmentManager(), "Share");
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:15,代碼來源:ShareChooserDialog.java

示例11: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putLong(RESOURCE_ID, mResourceId);
    outState.putString(RESOURCE_TITLE, mResourceTitle);
    if (isMovieDetailFragment) {
        outState.putParcelable(DETAILS, mMovieDetail);
    } else {
        outState.putParcelable(DETAILS, mTVShowDetail);
    }
    outState.putParcelableArrayList(SIMILAR, (ArrayList<? extends Parcelable>) mSimilarList);
    outState.putParcelableArrayList(CAST, (ArrayList<? extends Parcelable>) mCastList);
}
 
開發者ID:scaffeinate,項目名稱:Inflix,代碼行數:15,代碼來源:BaseDetailsFragment.java

示例12: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
@Override protected Parcelable onSaveInstanceState() {
  super.onSaveInstanceState();
  Bundle bundle = new Bundle();
  bundle.putParcelable("superState", super.onSaveInstanceState());
  bundle.putString("editText_title",mEditText.getText().toString());
  return bundle;
}
 
開發者ID:omidheshmatinia,項目名稱:RippleValidatorEditText,代碼行數:8,代碼來源:RippleValidatorEditText.java

示例13: newInstance

import android.os.Bundle; //導入方法依賴的package包/類
public static MediaGridFragment newInstance(Configuration configuration) {
    MediaGridFragment fragment = new MediaGridFragment();
    Bundle bundle = new Bundle();
    bundle.putParcelable(EXTRA_CONFIGURATION, configuration);
    fragment.setArguments(bundle);
    return fragment;
}
 
開發者ID:Loofer,項目名稱:Watermark,代碼行數:8,代碼來源:MediaGridFragment.java

示例14: buildArgsForEdit

import android.os.Bundle; //導入方法依賴的package包/類
public static Bundle buildArgsForEdit(int aid, @NonNull PhotoAlbum album, @NonNull PhotoAlbumEditor editor) {
    Bundle bundle = new Bundle();
    bundle.putParcelable(EXTRA_EDITOR, editor);
    bundle.putParcelable(Extra.ALBUM, album);
    bundle.putInt(Extra.ACCOUNT_ID, aid);
    return bundle;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:8,代碼來源:CreatePhotoAlbumFragment.java

示例15: addAccount

import android.os.Bundle; //導入方法依賴的package包/類
@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException {
    Log.d(TAG, "addAccount: called.");

    final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
    intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType);
    intent.putExtra(AuthenticatorActivity.ARG_IS_ADDING_NEW_ACCOUNT, true);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);

    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);
    return bundle;
}
 
開發者ID:Aentfs,項目名稱:Phony-Android,代碼行數:14,代碼來源:PhonyAuthenticator.java


注:本文中的android.os.Bundle.putParcelable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。