Android 如何进行页面传递对象

   当我们从一个页面调到另一个页面的时候,需要把该页面的一些设定值也传递给下一个页面。当要传递的值很多时,我们可以传递一个对象。

   页面1:

Intent intent = new Intent(PageOneActivity.this, PageTwoActivity.class);
SoftwareProlemInfo info = softwareProlemInfos.get(position);

Bundle bundle = new Bundle();
bundle.putSerializable("softPro", info);
intent.putExtras(bundle);
startActivity(intent);

 页面2:

 SoftwareProlemInfo softwareProlemInfo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pagetwo);

        Intent intent  = this.getIntent();
        softwareProlemInfo = (SoftwareProlemInfo)intent.getSerializableExtra("softPro");
     ....
}
其中:SoftwareProlemInfo是一个Serializable化的类。
高山流水,海纳百川!
原文地址:https://www.cnblogs.com/ahcc08/p/6666530.html