如何使用putextra将变量的值从第一活动直接传递给第三活动? [英] how to directly pass value of a variable from 1st activty to 3rd activity using putextra?

查看:60
本文介绍了如何使用putextra将变量的值从第一活动直接传递给第三活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用putextra将变量的值从第一活动直接传递到第三活动?

how to directly pass value of a variable from 1st activity to 3rd activity using putextra?

例如:

如果我按下按钮,则在第一个屏幕(第一个活动)中有一个变量A,它将显示第二个屏幕.第二屏幕(第二活动)具有一个按钮.如果我单击按钮,它将打开第三个屏幕(第三个活动),并在第三个屏幕(第三个活动)的文本视图中显示变量A.

I have a variable A in the first screen (first activity) if I hit the button it will show the 2nd screen. The 2nd screen(2nd activity) has a button. If I click the button it will open the 3rd screen(3rd activity) and it will show the variable A in the textview of 3rd screen (3rd activity).

如何将变量A的值从第一个屏幕直接传递到第三个屏幕(第三个活动). (1st-> 3rd)

how can I pass the value of variable A from the first screen DIRECTLY to the third screen(third activity). (1st->3rd)

是否可以直接传递值?还是我应该先在第二活动中通过它,然后再传递到第三活动(1st-> 2nd-> 3rd)

is it possible to directly pass the value ? or should I pass it in 2nd activity first before passing to 3rd activity (1st->2nd->3rd)

推荐答案

实际上不可能直接从第一项活动转到第三项...

Actually its not possible to go from 1st activity to 3rd directly...

您必须必须遵循活动堆栈.

You must have to follow the activity stack..

因此,如果您希望将数据从1号传递到3号,请紧跟

So if you want the data to be passed from 1st to 3rd follow by

第一->第二->第三

使用@Lalit Poptani建议的意图

with the use of intent suggested by @Lalit Poptani

这篇关于如何使用putextra将变量的值从第一活动直接传递给第三活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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