使用Bundle在Activity之间交换数据:
Intent是Activity的信使,Intent本身并不具备存储数据的能力,需要借助Bundle来实现,BundleST类似C++STL库中的map
在android中将要保存的数据存放到Bundle当中,通过Intent提供的putExtras()方法保存到Intent当中,然后用startActivity()方法启动另一个Activity
为Bundle插入数据:
bundle对象名.putCharSequence(key,value);
将Bundle的数据保存到intent中:
intent对象名.putExtras(bundle对象名);
接收另一个Activity中发送的Intent:
intent对象名 = getIntent();
接收另一个Activity中Intent携带的bundle数据:
bundle对象名 = intent对象名.getExtras();
如果Bundle要保存的数据包不是基本数据类型而是自定义类类型,就需要实现Serializable或者Parcelable接口
检测两个字符串是否相同:
字符串a.equals(字符串b);
获取用户输入的信息:
String对象名 = ((EditText)findViewById(R.id.组件id)).getText().toString();