傳送的LoginFragment
Bundle bundle = new Bundle();
bundle.putSerializable(BundleIndex.LoginFragment.toString(), user);
MoveStockFragment moveStockFragment = new MoveStockFragment();
TransactionHandler.getInstance().transition(getActivity(), bundle, this, moveStockFragment, R.id.mainFrameLayout);
收到的 MoveStockFragment中
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.movestockfragment, container, false);
Bundle bundle = getArguments();
if(bundle==null){
Utils.instance.log("MoveStockFragment:bundle==null");
}
user = (User) bundle.getSerializable(BundleIndex.LoginFragment.toString());
bundle.remove(BundleIndex.LoginFragment.toString());//要記得刪掉避免再次取得
ButterKnife.inject(this, v);
return v;
}
---------------------------------------------------------
送的ACTIVITY
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putSerializable("FavoriteStoreWrapper", favoriteStoreAryList.get(position));
intent.putExtras(bundle);
intent.setClass(getActivity(), NearByDetailActivity.class);
startActivity(intent);
收的ACTIVITY
Bundle bundle = this.getIntent().getExtras();
favoriteStoreWrapper =
(FavoriteStoreWrapper) getIntent().getSerializableExtra("FavoriteStoreWrapper");
沒有留言:
張貼留言