
本文共 2710 字,大约阅读时间需要 9 分钟。
���Android������������Activity���������������������������������������������������������������������������������������������������������
���A���
������������������AActivity���������BActivity������������������������������������
Intent intent = new Intent(AActivity.this, BActivity.class);Bundle bundle = new Bundle();bundle.putInt("year", 21);bundle.putString("name", "cxh");intent.putExtras(bundle);startActivity(intent);
���������������������������������������������Intent���������������������Activity���BActivity������������������������Bundle���������������������������������������������Bundle���������������Bundle���������Intent������������putExtras
������������������������������������������������������startActivity
������������������Activity���
���B���
������������BActivity���������AActivity���������������������������������������������������������
Bundle bundle = getIntent().getExtras();String name = bundle.getString("name");int age = bundle.getInt("year");
���BActivity������������������getIntent()
���������������Activity������������������������������getExtras()
���������������������Bundle������������������������������Bundle������������������������������������������������������
Bactivity���������Aactivity
���reverse���������������������������������������������ActivityResult���������������������������BActivity������������������AActivity������������������
Intent intent = new Intent();Bundle bundle1 = new Bundle();bundle1.putString("hao", "h1231654h");intent.putExtras(bundle1);setResult(Activity.RESULT_OK, intent);finish();
���������������������Intent���������������putExtras
���������������������������������������Intent������������������setResult
������������������������������Activity������������������finish()
������������������Activity������������������������������
���A���
���AActivity������������BActivity���������������������������������������������������
@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Bundle bundle = data.getExtras(); ToastUtils.showShortToast(this, "12346464"); String a = bundle.getString("hao"); textView.setText(a);}
������������onActivityResult
������������������������BActivity������������������������������������������������data.getExtras()
������������������������������������������������������������������������������������������������������������
���������������������������������������Activity������������������������������������������������������������������������������������Bundle���Intent������������������������������������������������Activity������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
