---
title: "Activity间的传值"
author: "AndLi"
date: "2011-10-12T08:00:01Z"
tags: []
categories: ["移动开发"]
slug: "activity"
draft: false
lastmod: "2011-10-11T21:15:23Z"
id: 1190059
url: "https://andli.iteye.com/blog/1190059"
---

```
String name = myEditText.getText().toString();
				 
Bundle data = new Bundle();//实例化Bundle对象
data.putString("name", name);//将姓名信息添加到Bundle对象中
		         
Intent intent = new Intent(MainActivity.this,ResultActivity.class);
intent.putExtras(data);
startActivity(intent);
```

 

获取传递过来的值：

```
Intent intent = getIntent();
Bundle b = intent.getExtras();
String name = b.getString("name");
```