Example usage for android.os Bundle getSerializable

List of usage examples for android.os Bundle getSerializable

Introduction

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

Prototype

@Override
@Nullable
public Serializable getSerializable(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.cmput301.classproject.UI.SubmissionViewActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_submission_view);
    getActionBar().setDisplayHomeAsUpEnabled(false);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        this.submission = (Submission) extras.getSerializable("Submission");
    }//from ww w  .j  a va  2s.  co m

    if (submission == null) {
        finish();
    } else {

        submissionPhotos = submission.getImages();

        // Start recognizing the Layout elements.
        GridView gridView = (GridView) findViewById(R.id.submissionPhotoList);
        gridView.setAdapter(new ImageAdapter(this));

        // Fill out activity view using the submission object
        TextView authorText = (TextView) findViewById(R.id.view_author_name);
        authorText.setText(submission.getAuthor());

        TextView submissionSummary = (TextView) findViewById(R.id.view_submission_summary);
        submissionSummary.setText(submission.getSummary());

        TextView submissionText = (TextView) findViewById(R.id.view_submission_text);
        submissionText.setText(submission.getTextSubmission());

        TextView access = (TextView) findViewById(R.id.view_submission_access);
        access.setText(submission.getAccess().toString());

        // TODO display timestamp, at the moment we only save it.
    }

}

From source file:com.github.mobile.ui.user.MembersFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    org = ((OrganizationSelectionProvider) getActivity()).addListener(this);
    if (org == null && savedInstanceState != null)
        org = (User) savedInstanceState.getSerializable(EXTRA_USER);
    setEmptyText(string.no_members);/* ww  w . j  ava2  s .c o m*/

    super.onActivityCreated(savedInstanceState);
}

From source file:com.github.mobile.ui.user.OrgMembersFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    org = ((OrganizationSelectionProvider) getActivity()).addListener(this);
    if (org == null && savedInstanceState != null)
        org = (User) savedInstanceState.getSerializable(EXTRA_USER);
    setEmptyText(R.string.no_members);/*from ww w .ja v  a 2s.c  om*/

    super.onActivityCreated(savedInstanceState);
}

From source file:com.cloudkick.CheckViewActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    CheckViewState previousState = (CheckViewState) getLastNonConfigurationInstance();
    if (previousState != null) {
        nodeName = previousState.nodeName;
        nodeId = previousState.nodeId;/*from  w  ww.j a v a2 s  .c  o m*/
        checkId = previousState.checkId;
        check = previousState.check;
    } else {
        Bundle data = this.getIntent().getExtras();
        nodeName = (String) data.getSerializable("nodeName");
        nodeId = (String) data.getSerializable("nodeId");
        checkId = (String) data.getSerializable("checkId");
        check = (Check) data.getSerializable("check");
    }

    String inflater = Context.LAYOUT_INFLATER_SERVICE;
    LayoutInflater li = (LayoutInflater) getSystemService(inflater);

    checkView = new RelativeLayout(this);
    li.inflate(R.layout.check_view, checkView, true);
    setContentView(checkView);

    setTitle(nodeName + ": " + check.type + " check");
    redrawCheck();
    reloadAPI();
}

From source file:com.github.mobile.ui.team.TeamListFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    org = ((OrganizationSelectionProvider) getActivity()).addListener(this);
    if (org == null && savedInstanceState != null)
        org = (User) savedInstanceState.getSerializable(EXTRA_USER);
    setEmptyText(R.string.no_teams);/*from w  ww.j  av  a 2  s .  com*/

    super.onActivityCreated(savedInstanceState);
}

From source file:com.example.firstapp.PlotMapJsonActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // get extra for intent
    Bundle getBundle = this.getIntent().getExtras();
    storedObj = (StoredObject) getBundle.getSerializable("object");
    Boolean restaurant = storedObj.getChkbox1();
    Boolean carrental = storedObj.getChkbox2();
    Boolean movies = storedObj.getChkbox3();
    Boolean shopping = storedObj.getChkbox4();

    url = createURL(restaurant, carrental, movies, shopping);

    setContentView(R.layout.activity_find_loc);
    setUpMapIfNeeded(url);//from   www  . j a v a 2s  . com
}

From source file:com.union.entertainment.ui.activity.PhotosViewPagerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_photos_show_layout);

    Bundle bundle = getIntent().getExtras();
    photoList = (List<Photo>) bundle.getSerializable("photos");
    position = bundle.getInt("position");
    if (photoList == null || photoList.size() < 1) {
        finish();//from  w  w w .  j  ava2 s. c  om
        return;
    }
    mViewPager = (HackyViewPager) findViewById(R.id.pager);

    mViewPager.setAdapter(new SamplePagerAdapter(this, photoList));

    if (savedInstanceState != null) {
        boolean isLocked = savedInstanceState.getBoolean(ISLOCKED_ARG, false);
        ((HackyViewPager) mViewPager).setLocked(isLocked);
    }

    mViewPager.setCurrentItem(position);
}

From source file:at.jclehner.rxdroid.DatePickerFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Calendar cal;

    final Bundle args = getArguments();
    if (args == null || !args.containsKey(ARG_DATE))
        cal = DateTime.nowCalendar();/*  w ww  .  ja v a  2s .c  o m*/
    else
        cal = DateTime.calendarFromDate((Date) args.getSerializable(ARG_DATE));

    final int d = cal.get(Calendar.DAY_OF_MONTH);
    final int m = cal.get(Calendar.MONTH);
    final int y = cal.get(Calendar.YEAR);

    if (Version.SDK_IS_JELLYBEAN_OR_NEWER) {
        // Workaround for Android issue #34833
        final Dialog dialog = new DatePickerDialog(getActivity(), null, y, m, d);
        dialog.setOnShowListener(this);
        return dialog;
    } else
        return new DatePickerDialog(getActivity(), mListener, y, m, d);
}

From source file:org.alfresco.mobile.android.api.session.impl.RepositorySessionImpl.java

@SuppressWarnings("unchecked")
public RepositorySessionImpl(Parcel o) {
    this.baseUrl = o.readString();
    this.userIdentifier = o.readString();
    this.password = o.readString();
    this.rootNode = o.readParcelable(FolderImpl.class.getClassLoader());
    this.repositoryInfo = (RepositoryInfo) o.readSerializable();
    this.cmisSession = (Session) o.readSerializable();
    Bundle b = o.readBundle();
    this.userParameters = (Map<String, Serializable>) b.getSerializable("userParameters");
    initServices();//w ww.j a va  2 s.  c  o m
}

From source file:com.judepereira.android.co.uncyclopedia.UncyclopediaActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    history = (Stack<ArticleHistory>) savedInstanceState.getSerializable("history");
    client.setHistory(history);//from  w w  w . j av a2s . c o  m
    client.setUniqueId(Math.random());
    client.setFeatured(false);
    try {
        client.setRestoring(true);
        wikiView.loadUrl(history.peek().getUrl());
    } catch (EmptyStackException ex) {
        history = new Stack<ArticleHistory>();
        client.setHistory(history);
        client.setUniqueId(Math.random());
        client.setFeatured(true);
        wikiView.loadUrl(c.RANDOM_FEATURED_URL);
    }
}