zoukankan      html  css  js  c++  java
  • Android Intent传递对象和集合

    Article article = JsonUtils.getArticle(content);          
    intent = new Intent(activity, CompositionCorrect.class);
    Bundle bundle = new Bundle();
    bundle.putSerializable("ARTICLE", article);
    intent.putExtras(bundle);
    startActivity(intent); 获取传递的对象
    private void initIntentData() {
    intent = getIntent();
    article = (Article) intent.getSerializableExtra("ARTICLE");
    tv_content.setText("" + article.getContent());
    spannableStringBuilder = new SpannableStringBuilder(tv_content.getText().toString());
    }
    传递集合 intent
    = new Intent(CompositionCorrectActivity.this,PiGaiCompletedActivity.class);
    Bundle bundle = new Bundle();
    for (int i = 0; i < mSpansCommit.size(); i++) {
    mSpansCommit.get(i).setColorSpan(null);
    }
    bundle.putSerializable("MSPANSCOMMIT", (Serializable)mSpansCommit);
    bundle.putSerializable("ARTICLE", article);
    intent.putExtras(bundle);
    startActivity(intent);
    获取集合 mSpansCommit
    = (List<Span>) intent.getSerializableExtra("MSPANSCOMMIT");
  • 相关阅读:
    移动web性能优化从入门到进阶
    授权保存到相册
    授权通讯地址
    windows putty 链接到 linux 免密码
    my docker note
    docker run -i -t --rm
    Command Not Found
    firewall-cmd 笔记
    vim 插件 Tabularize
    vim :find
  • 原文地址:https://www.cnblogs.com/xiaoyao095/p/4600146.html
Copyright © 2011-2022 走看看