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.fast.access.kam.widget.colorpicker.dashclockpicker.ColorPickerDialogDash.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putIntArray(KEY_COLORS, mColorChoices);
    outState.putSerializable(KEY_SELECTED_COLOR, mSelectedColor);
}

From source file:com.qubittech.feelknit.app.MainActivity.java

@Override
public void onFeelingCreated(Feeling feeling, List<Feeling> relatedFeelings) {
    RelatedFeelingFragment relatedFeelingsFragment = new RelatedFeelingFragment();
    Bundle bundle = new Bundle();
    bundle.putSerializable("feeling", feeling);
    bundle.putSerializable("relatedFeelings", (Serializable) relatedFeelings);

    relatedFeelingsFragment.setArguments(bundle);
    getSupportFragmentManager().beginTransaction()
            .replace(com.qubittech.feelknit.app.R.id.content_frame, relatedFeelingsFragment, "RelatedFeelings")
            .addToBackStack("RelatedFeelings").commit();
}

From source file:com.balch.auctionbrowser.MainActivity.java

private void showDetail(final Auction auction) {
    AuctionDetailDialog dialog = new AuctionDetailDialog();
    Bundle args = new Bundle();

    final Note note = auctionView.getNote(auction);
    if (note != null) {
        args.putString(AuctionDetailDialog.ARG_NOTE, note.getNote());
    }/*from  w w w  . jav a2  s  .  c  o  m*/
    args.putSerializable(AuctionDetailDialog.ARG_AUCTION, auction);
    dialog.setArguments(args);
    dialog.setNoteDetailDialogListener(new AuctionDetailDialog.NoteDetailDialogListener() {
        @Override
        public void onSave(String text) {
            saveNote(auction, note, text);
        }

        @Override
        public void onClear() {
            clearNote(auction, note);
        }
    });
    dialog.show(getSupportFragmentManager(), "AuctionDetailDialog");
}

From source file:com.sababado.network.AsyncServiceCallTask.java

private Bundle parseResponse(HttpResponse result) {
    Bundle responseBundle = new Bundle();
    if (result != null) {
        if (result.getStatusLine().getStatusCode() != 200) {
            //something is wrong
            int statusCd = result.getStatusLine().getStatusCode();
            responseBundle.putString(EXTRA_ERR_MSG, "Service Failed: " + statusCd + ": "
                    + result.getStatusLine().getReasonPhrase() + ": " + mService.getUrl());
            responseBundle.putInt(EXTRA_ERR_CODE, statusCd);
            return responseBundle;
        }//  ww w .j  a  v  a2s . c om
        try {
            Bundle bundle = new Bundle();
            bundle.putSerializable(EXTRA_SERVICE_RESULT,
                    mService.parseResults(result.getEntity().getContent()));
            return bundle;
        } catch (IllegalStateException e) {
            responseBundle.putString(EXTRA_ERR_MSG, "IllegalStateException: " + e.getMessage());
            responseBundle.putInt(EXTRA_ERR_CODE, ERR_CODE_PARSE_ILLEGAL_STATE);
            return responseBundle;
        } catch (IOException e) {
            responseBundle.putString(EXTRA_ERR_MSG, "IOException: " + e.getMessage());
            responseBundle.putInt(EXTRA_ERR_CODE, ERR_CODE_PARSE_IOEXCEPTION);
            return responseBundle;
        } catch (XmlPullParserException e) {
            responseBundle.putString(EXTRA_ERR_MSG, "XmlPullParserException: " + e.getMessage());
            responseBundle.putInt(EXTRA_ERR_CODE, ERR_CODE_XML_PULLPARSER_EXCEPTION);
            return responseBundle;
        }
    } else {
        responseBundle.putString(EXTRA_ERR_MSG, "No result from service call.");
        responseBundle.putInt(EXTRA_ERR_CODE, ERR_CODE_NO_RESULTS);
        return responseBundle;
    }
}

From source file:com.kccomy.orgar.ui.files.FileListFragment.java

private void showNoteTreeFragment(String name) {
    Fragment noteTreeFragment = new NoteFragment();
    Bundle bundle = new Bundle();
    bundle.putSerializable("FILE_NAME", name);
    noteTreeFragment.setArguments(bundle);
    getHoldingActivity().addFragment(noteTreeFragment, true);
}

From source file:com.qubittech.feelknit.app.MainActivity.java

public void ShowCommentsFragment(Feeling feeling, String feelingId, String feelingText, String username) {

    if (feeling == null && feelingId == null) {
        new getUserFeelingTask().execute(feelingText, username);
        return;/* w  w  w .j av a2s.c  om*/
    }

    CommentsFragment commentsFragment = new CommentsFragment();
    Bundle bundle = new Bundle();
    bundle.putSerializable("feeling", feeling);
    bundle.putSerializable("feelingId", feelingId);
    bundle.putSerializable("user", ApplicationHelper.getUserName(getApplicationContext()));
    commentsFragment.setArguments(bundle);
    getSupportFragmentManager().beginTransaction()
            .replace(com.qubittech.feelknit.app.R.id.content_frame, commentsFragment, "Comments")
            .addToBackStack("Comments").commit();
}

From source file:net.reichholf.dreamdroid.fragment.abs.AbstractHttpListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putSerializable(BUNDLE_KEY_LIST, mMapList);
}

From source file:com.github.mobile.ui.repo.RepositoryListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    User org = this.org.get();
    if (org != null)
        outState.putSerializable(EXTRA_USER, org);
}

From source file:ca.rmen.android.scrumchatter.meeting.detail.MeetingFragment.java

/**
 * Read the given meeting in the background. Init or restart the loader for the meeting members. Update the views for the meeting.
 *//*from   www .  java  2  s .  c om*/
private void loadMeeting() {
    Log.v(TAG, "loadMeeting: current meeting = " + mMeeting);
    Activity activity = getActivity();
    if (activity == null) {
        Log.w(TAG,
                "loadMeeting called when we are no longer attached to the activity. A monkey might be involved");
        return;
    }
    State meetingState = mMeeting == null ? (State) getArguments().getSerializable(Meetings.EXTRA_MEETING_STATE)
            : mMeeting.getState();
    Bundle bundle = new Bundle(1);
    bundle.putSerializable(Meetings.EXTRA_MEETING_STATE, meetingState);
    if (mAdapter == null) {
        mAdapter = new MeetingCursorAdapter(activity, mMemberStartStopListener);
        mBinding.recyclerViewContent.recyclerView.setAdapter(mAdapter);
        getLoaderManager().initLoader((int) mMeetingId, bundle, mLoaderCallbacks);
    } else {
        getLoaderManager().restartLoader((int) mMeetingId, bundle, mLoaderCallbacks);
    }

    mMeetings.readMeeting(mMeetingId).doOnSuccess(meeting -> mMeeting = meeting).subscribe(this::displayMeeting,
            throwable -> activity.getContentResolver().unregisterContentObserver(mMeetingObserver));
}

From source file:dtu.ds.warnme.app.activity.MainActivity.java

@Override
public void onApproachingEvent(Event event) {
    if (warningDialog != null && event.equals(warningDialog.getEvent())) {
        return;// w w  w .  j a  v a2s  .c  o m
    }

    if (alreadyWarned.contains(event)) {
        return;
    }
    alreadyWarned.add(event);

    if (warningDialog != null) {
        warningDialog.dismiss();
    }

    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag(LoginDialog.class.getName());
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    Bundle args = new Bundle();
    args.putSerializable(KEY_EVENT, event);

    warningDialog = new WarningDialog();
    warningDialog.setEvent(event);
    warningDialog.setArguments(args);
    warningDialog.show(ft, WarningDialog.class.getName());
}