如何将类从一个活动传递到另一个活动 [英] How to pass class from one activity to another

查看:199
本文介绍了如何将类从一个活动传递到另一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将班级的班级和内容从一个活动传递到另一个活动。



例如,我有两个活动活动A和活动B. br $>


i在活动B中创建了一个类。



i希望将此类从活动B传递回活动A 。





另一个问题是:



我怎么能放从edittext加载到两个按钮的文本。



例如,有一个edittext和两个按钮。



i想要将edittext中的文本加载到两个按钮但同时加载差异文本。

例如我想将文本button1设置为一个按钮而button2设置为另一个按钮并且这些文本同时从编辑文本加载

解决方案

你不能直接在意图之间做到;你需要使用 Serializable类 [ ^ ]或 Parcelable class [ ^ ]。

I want to pass the class and content of the class from one activity to another activity.

For example i have two activities activity A and activity B.

i created a class in activity B.

i want to pass this class from activity B back to activity A.


ANOTHER QUESTION IS THAT:

How i can put text loaded from the edittext to the two button.

For example there is a one edittext and two buttons.

i want to load the text from the edittext to the two button but difference text at the same time.
for example i want to set the text button1 to the one button and button2 to the another button and these text loaded from the edit text at the same time

解决方案

You cannot do it directly between intents; you need to use the Serializable class[^] or the Parcelable class[^].


这篇关于如何将类从一个活动传递到另一个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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