Presentation is loading. Please wait.

Presentation is loading. Please wait.

7.3 Intent传值.

Similar presentations


Presentation on theme: "7.3 Intent传值."— Presentation transcript:

1 7.3 Intent传值

2 方式 1.传递数据 2.传递对象

3 传递数据 传值: Intent intent=new Intent(); intent.putExtra("extra", "这是页面一传来的值!"); intent.setClass(Test_for_intentActivity.this, actpage2.class); startActivity(intent); 取值: Intent intent=getIntent(); String StringE=intent.getStringExtra("extra"); TextView text2=(TextView)findViewById(R.id.textView2); text2.setText(StringE);

4 传递对象 传值: Bundle bundle = new Bundle(); bundle.putString("USERNAME", et_username.getText().toString()); intent.putExtras(bundle); intent.setClass(loginactive.this, informationactive.class); startActivity(intent); 取值: Bundle bundle = this.getIntent().getExtras(); String str=bundle.getString("USERNAME"); tv.setText(str);


Download ppt "7.3 Intent传值."

Similar presentations


Ads by Google