Intent传递对象的方法

时间:2025-01-01 22:07:20
//传递对象
Bundle bundle = new Bundle();
intent = new Intent(getApplicationContext(), YourActivity.class);
bundle.putSerializable("youJavaBean", youJavaBean);
intent.putExtras(bundle);
startActivity(intent); //接收对象
Intent intent = getIntent();
Bundle bundle=intent.getExtras(); //接收对象
youJavaBean= (YouJavaBean)bundle.get("youJavaBean");

  很简单的,就不一一解释了