当前位置: 首页>>代码示例>>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;未经允许,请勿转载。