python bottle框架(WEB开发、运维开发)教程
2015-05-26 14:32
701 查看
摘自帮助文档:
Sometimes you want to get a result back from an activity when it ends. For example, you may start an activity that lets the user pick a person in a list of contacts; when it ends, it returns the person that was selected. To do this, you call the
When an activity exits, it can call
1 需要从Activity2 向Activity1回调并传参时使用
public void startActivityForResult (Intent intent, int requestCode)
Intent intent:系统会根据这个确定目的Activity
int requestCode:用于标识该Intent 回来后确定是不是想要的返回
2 其返回的数据能在重写的onActivityResult中获取。
3 在Activity2中调用setResult(int)来返回数据。
综上,当需要从Activity2返回Activity1时需要以上三个地方的配合。
Sometimes you want to get a result back from an activity when it ends. For example, you may start an activity that lets the user pick a person in a list of contacts; when it ends, it returns the person that was selected. To do this, you call the
startActivityForResult(Intent, int)version with a second integer parameter identifying the call. The result will come back through your
onActivityResult(int, int, Intent)method.
When an activity exits, it can call
setResult(int)to return data back to its parent. It must always supply a result code, which can be the standard results RESULT_CANCELED, RESULT_OK, or any custom values starting at RESULT_FIRST_USER. In addition, it can optionally return back an Intent containing any additional data it wants. All of this information appears back on the parent's
Activity.onActivityResult(), along with the integer identifier it originally supplied
1 需要从Activity2 向Activity1回调并传参时使用
startActivityForResult(Intent, int)。
public void startActivityForResult (Intent intent, int requestCode)
Intent intent:系统会根据这个确定目的Activity
int requestCode:用于标识该Intent 回来后确定是不是想要的返回
2 其返回的数据能在重写的onActivityResult中获取。
3 在Activity2中调用setResult(int)来返回数据。
综上,当需要从Activity2返回Activity1时需要以上三个地方的配合。
相关文章推荐
- Python实战开发之Pyramid Web框架在商城项目中的应用教程
- 【Python web 开发】 bottle 简单教程 (三)
- Python实战开发之Pyramid Web框架在商城项目中的应用教程
- 【Python web 开发】 bottle 简单教程 (四)
- [深度分析] Python Web 开发框架 Bottle(这个真的他妈的经典!!!)
- 【Python web 开发】 bottle 简单教程 (一)
- [深度分析] Python Web 开发框架 Bottle
- 【Python】Bottle框架下Python Web开发的跨域访问
- Python超级明星WEB开发框架Flask简明教程
- 【Python web 开发】 bottle 简单教程 (二)
- [深度分析] Python Web 开发框架 Bottle(作者 @Sunng)
- pythonanywhere网站上开发和测试bottle框架构建的WEB网站
- [深度分析] Python Web 开发框架 Bottle(作者 @Sunng)
- python web 开发框架之Bottle
- 我的第一个python web开发框架(12)——工具函数包说明(三)
- python Web开发框架-Django (1)
- Python Web接口开发学习笔记(基于Django框架)(一)
- python bottle框架开发任务管理系统 V_1.0版
- 10个用于Web开发的最好 Python 框架
- python下的web开发框架-Django,建立模型