android的Intent返回值
来源:互联网 发布:安徽联通云计算 编辑:程序博客网 时间:2024/06/05 04:00
@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);one=(EditText) this.findViewById(R.id.one);two=(EditText) this.findViewById(R.id.two);result=(EditText) this.findViewById(R.id.result);button=(Button)this.findViewById(R.id.button);button.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {String a=one.getText().toString();String b=two.getText().toString();Intent intent=new Intent(MainActivity.this,OtherActivity.class);intent.putExtra("a", a);intent.putExtra("b", b);startActivityForResult(intent, 1);}});}@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {super.onActivityResult(requestCode, resultCode, data);Log.i("Main", "requestCode:"+requestCode+"resultCode:"+resultCode);if(resultCode==2){if(requestCode==1){result.setText(data.getStringExtra("tree"));}}}}
另一个activity
protected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);setContentView(R.layout.other);textView = (TextView) this.findViewById(R.id.msg);editText = (EditText) this.findViewById(R.id.three);button = (Button) this.findViewById(R.id.button2);Intent intent = getIntent();String a = intent.getStringExtra("a");String b = intent.getStringExtra("b");textView.setText(a + " + " + b + " =?");button.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View arg0) {Intent intent=new Intent();String tree=editText.getText().toString(); intent.putExtra("tree",tree); setResult(2, intent); finish();}});}}
- android的Intent返回值
- Android中Intent返回值
- android中激活一个带返回值的Intent
- 带返回值的Intent
- android:跳转,Intent,有无返回值
- 重写返回键(intent 带返回值的)
- Android Intent传值反馈,向后传递,要求返回的传值
- android Intent.setType() 过滤图片,返回所有的文件类型
- Android_有返回值的Intent和无返回值的Intent
- android 打开一个选择拍照或是本地图库的Intent,接受此Intent返回的信息
- Android的intent:基础以及显示/隐式使用Intent,SD挂载识别&& 通过intent返回结果
- Android实战总结之返回键返回上一级Activity(Intent的一种用法)
- Android实战总结之返回键返回上一级Activity(Intent的一种用法)
- 【Android 开发教程】从Intent返回结果
- android intent传递数据,返回函数
- android之无返回结果跳转intent
- android之有返回结果跳转intent
- Android intent 传递对象以及返回刷新
- Java读文件的一些注意的地方
- 使用jQuery Mobile 快速开发mobile 网站
- FFMPEG-Java 入门
- 导出CSV文件
- iOS学习笔记25—NSDate的常用用法(一)
- android的Intent返回值
- Android 对话框(Dialog)大全 建立你自己的对话框
- Android init.rc文件浅析
- jquery操作常用input
- Android企业级程序完全退出的解决方案
- Android消息处理机制
- Android_rom存储,sp存储,sdcard存储
- jQuery miniUI学习地址
- 页面局部刷新( ScriptManager 和 UpdatePanel)(转)