通过从一个屏幕值到另一个? [英] pass values from one screen to another?

查看:153
本文介绍了通过从一个屏幕值到另一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从一个屏幕传递数据的(字符串)到另一个屏幕。在按钮的时候点击我需要传递的第一个画面值到下一个画面。

I need to pass data's (String) from one screen to another screen. At the time of button click i need to pass values from first screen to the next screen.

推荐答案

您可以沿着传递数据,在启动第二个活动的意图演员:

You can pass along data as extras in the intent that starts the second activity:

Intent myIntent = new Intent(view.getContext(), NextActivity.class); 
myIntent.putExtra("extra", id);
startActivityForResult(myIntent, 0);   

在您的个人资料的活动的onCreate方法,您可以访问其它功能:

In the oncreate method of your profile activity you can access the extras:

int id = getIntent().getStringExtra("extra");       

如果你是新的机器人,它可以帮助通读的开发文档的例子,像的记事本教程。

If you are new to Android, it might help to read through the examples in the developer docs, like the notepad tutorial.

这篇关于通过从一个屏幕值到另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆