Example usage for android.os Bundle putSerializable

List of usage examples for android.os Bundle putSerializable

Introduction

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

Prototype

@Override
public void putSerializable(@Nullable String key, @Nullable Serializable value) 

Source Link

Document

Inserts a Serializable value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.bukanir.android.activities.MovieActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putSerializable("movie", movie);
}

From source file:com.devergence.example.fraglistview.fragments.FragmentFeatured.java

/**
 * Almacena el estado de las variables globales
 * @param outState//from   www.  jav  a  2  s. co m
 */
void saveInstanceState(Bundle outState) {
    if (outState != null)
        outState.putSerializable(STATEKEY_ITEM, mFeaturedObject);
}

From source file:at.bitfire.davdroid.syncadapter.SelectCollectionsFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.next:
        ServerInfo serverInfo = (ServerInfo) getArguments().getSerializable(KEY_SERVER_INFO);

        // synchronize only selected collections
        for (ServerInfo.ResourceInfo addressBook : serverInfo.getAddressBooks())
            addressBook.setEnabled(false);
        for (ServerInfo.ResourceInfo calendar : serverInfo.getCalendars())
            calendar.setEnabled(false);//from   w ww .j  av  a 2 s .c  o  m

        ListAdapter adapter = getListView().getAdapter();
        for (long id : getListView().getCheckedItemIds()) {
            int position = (int) id + 1; // +1 because header view is inserted at pos. 0 
            ServerInfo.ResourceInfo info = (ServerInfo.ResourceInfo) adapter.getItem(position);
            info.setEnabled(true);
        }

        // pass to "account details" fragment
        AccountDetailsFragment accountDetails = new AccountDetailsFragment();
        Bundle arguments = new Bundle();
        arguments.putSerializable(SelectCollectionsFragment.KEY_SERVER_INFO, serverInfo);
        accountDetails.setArguments(arguments);

        getFragmentManager().beginTransaction().replace(R.id.fragment_container, accountDetails)
                .addToBackStack(null).commitAllowingStateLoss();
        break;
    default:
        return false;
    }
    return true;
}

From source file:com.juick.android.MessagesActivity.java

protected void initWithMessagesSource() {
    setContentView(R.layout.messages);//from w w w. j ava2  s .  co  m
    TextView oldTitle = (TextView) findViewById(R.id.old_title);
    oldTitle.setText(messagesSource.getTitle());
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    mf = new MessagesFragment();
    mf.init(restoreData, this);
    Bundle args = new Bundle();
    args.putSerializable("messagesSource", messagesSource);
    mf.setArguments(args);
    ft.replace(R.id.messagesfragment, mf);
    ft.commit();
}

From source file:augsburg.se.alltagsguide.settings.PrefFragment.java

public void refresh(LoadingType type) {
    Bundle bundle = new Bundle();
    bundle.putSerializable(LOADING_TYPE_KEY, type);
    getLoaderManager().restartLoader(0, bundle, this);
}

From source file:ch.citux.td.ui.fragments.ChannelFragment.java

public void showPlaylist(final TwitchBroadcast broadcast) {
    if (broadcast != null && broadcast.getChunks() != null) {
        Bundle args = new Bundle();
        args.putSerializable(CHUNKS, broadcast);
        playlistFragment = TDFragment.instantiate(ChannelPlaylistFragment.class, args);
        setFragment(playlistFragment, true);
    }//from   ww w.j a v  a2s  .c o  m
}

From source file:com.groksolutions.grok.mobile.instance.InstanceListActivity.java

@Override
protected Fragment createTabFragment(Tab tab) {
    InstanceListFragment fragment = new InstanceListFragment();
    Bundle args = new Bundle();
    AggregationType type = (AggregationType) tab.getTag();
    args.putSerializable(AggregationType.class.getCanonicalName(), type);
    fragment.setArguments(args);/*from w w  w  .jav  a2  s . c  o  m*/
    return fragment;
}

From source file:ch.citux.td.ui.fragments.ChannelFragment.java

public void updateChannel(final TwitchChannel channel) {
    this.channel = channel;
    Picasso.with(getActivity()).load(channel.getLogo().getUrl(TwitchLogo.Size.LARGE))
            .placeholder(R.drawable.default_channel_logo_medium).into(imgLogo);
    lblTitle.setText(channel.getDisplay_name());
    lblStatus.setText(channel.getChannelStatus().getText());
    btnStream.setVisibility(//  w ww.  ja v  a 2s . c  o  m
            channel.getChannelStatus() == TwitchChannel.Status.ONLINE ? View.VISIBLE : View.GONE);

    emptyView.showProgress();
    emptyView.setVisibility(View.GONE);
    content.setVisibility(View.VISIBLE);

    Bundle args = new Bundle();
    args.putSerializable(CHANNEL, channel);
    videosFragment = TDFragment.instantiate(ChannelVideosFragment.class, args);
    setFragment(videosFragment, false);
}

From source file:carsharing.starter.automotive.iot.ibm.com.mobilestarterapp.Reservations.Reservations.java

public void setContent(final ArrayList<ReservationsData> reservationsArray) {
    final FragmentActivity activity = getActivity();
    if (activity == null) {
        return;/*  ww  w .  j  a  v a2 s.  c om*/
    }
    final ListView listView = (ListView) view.findViewById(R.id.listView);

    final ReservationsDataAdapter adapter = new ReservationsDataAdapter(activity.getApplicationContext(),
            reservationsArray);
    listView.setAdapter(adapter);

    final ArrayList<ReservationsData> finalReservationsArray = reservationsArray;
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapter, View view, int position, long arg) {
            final Intent completeReservation = new Intent(view.getContext(), CompleteReservation.class);

            final Bundle bundle = new Bundle();
            bundle.putSerializable("reservationData", finalReservationsArray.get(position));
            completeReservation.putExtras(bundle);

            startActivity(completeReservation);
        }
    });

    final ActionBar supportActionBar = ((AppCompatActivity) activity).getSupportActionBar();
    switch (reservations.size()) {
    case 0:
        supportActionBar.setTitle("You have no reservations.");
    case 1:
        supportActionBar.setTitle("You have one reservation.");
    default:
        supportActionBar.setTitle("You have " + reservations.size() + " reservations.");
    }
}

From source file:com.liuwuping.sm.ui.stars.StarsFragment.java

@Override
protected void initView() {
    starsPresenter = new StarsPresenter(this);
    swipeRefreshLayout.setColorSchemeColors(R.color.colorPrimary, R.color.colorAccent,
            R.color.colorPrimaryDark);/*from   w w  w  . jav a 2 s.  co  m*/
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            starsPresenter.loadRepos();
        }
    });

    recyclerView.setLayoutManager(new LinearLayoutManager(this.getActivity()));
    SimplePaddingDecoration decoration = new SimplePaddingDecoration(this.getActivity(), R.dimen.dp16,
            R.dimen.dp16, R.dimen.dp10, 0);
    recyclerView.addItemDecoration(decoration);
    recyclerView.setHasFixedSize(true);
    adapter = new RepoAdapter();
    recyclerView.setAdapter(adapter);

    RecyclerItemClickSupport.addTo(recyclerView)
            .setOnItemClickListener(new RecyclerItemClickSupport.OnItemClickListener() {
                @Override
                public void onItemClicked(RecyclerView recyclerView, int position, View v) {
                    Repo repo = repos.get(position);
                    Bundle bundle = new Bundle();
                    bundle.putSerializable("repo", repo);
                    switchActivity(RepoDetailActivity.class, bundle);
                }
            });

    swipeRefreshLayout.post(new Runnable() {
        @Override
        public void run() {
            swipeRefreshLayout.setRefreshing(true);
        }
    });
    starsPresenter.loadRepos();
}