1.android 开发学习---Intent 用法

1.发送信息的activity的Intent

public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";

EXTRA_MESSAGE 发送信息的标识;

Intent intent = new Intent(this,DisplayMessage.class);
intent.putExtra(EXTRA_MESSAGE,message);
startActivity(intent);


2.接收消息的activity的Intent

Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);




你可能感兴趣的:(android,android,intent)