一.所花时间

1h

二.代码量

30行

三.博客量

1篇

四.了解到的知识点

String request = "你吃饭了吗?来我家吃吧";
 // 创建一个意图对象,准备跳到指定的活动页面
Intent intent = new Intent(this, ActResponseActivity.class);
 Bundle bundle = new Bundle();  // 创建一个新包裹
// 往包裹存入名为request_time的字符串
bundle.putString("request_time", DateUtil.getNowTime());
 // 往包裹存入名为request_content的字符串
bundle.putString("request_content", request);
 intent.putExtras(bundle);  // 把快递包裹塞给意图
// 期望接收下个页面的返回数据。第二个参数为本次请求代码
startActivityForResult(intent, 0);


// 从上一个页面传来的意图中获取快递包裹
Bundle bundle = getIntent().getExtras();
 // 从包裹中取出名为request_time的字符串
String request_time = bundle.getString("request_time");
 // 从包裹中取出名为request_content的字符串
String request_content = bundle.getString("request_content");
 String desc = String.format("收到请求消息:\n请求时间为%s\n请求内容为%s",
 request_time, request_content);
 tv_request.setText(desc);  // 把请求消息的详情显示在文本视图上

 

posted on 2024-04-20 23:56  leapss  阅读(7)  评论(0)    收藏  举报