传递变量从一个类到另一个wiithout使用意图得到额外 [英] Passing variables from one class to another wiithout using the intent get extra

查看:163
本文介绍了传递变量从一个类到另一个wiithout使用意图得到额外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做某些Android code今天现在的问题是我需要传递的变量。场景是,我需要先登录Facebook的再取我的信息。后来又来了一个闪屏,其中会显示我的名字,使用意向等信息。随后主屏幕上会出现,一切从启动画面中的数据现在也可以使用一个意图传递到主屏幕,但问题是,这主屏仅仅是我的tabViews的容器,其中我可以从一个随时浏览网页到另一个,我认为没有必要对我来说,这部分再次使用意图。现在我需要让所有的数据传递从被传递到主屏幕到我的标签之一,并在一个TextView显示它。

I'm doing some android code today and now the problem is I need to get the variables passed. The scene is that I need to login first to facebook then fetch my information. afterwards here comes a splash screen where it will display my name, etc info using the intent. afterwards the main screen will now appear and all of the data from the splash screen will now be passed to the main screen using also an intent but the problem is that this main screen is just a container for my tabViews wherein I can navigate anytime from one page to another and I think there is no need for me to use the intent again in this part. Now I need to get all the passed data from which is passed to the main screen down to one of my tab and display it on a TextView.

推荐答案

定义变量作为公共静态或另一种选择是卖场变量的值到共享preferences和检索下一个活动preferences的价值,并参考以下链接了解更多信息。

Define Variable as Public Static or another option is store variable's value into Shared Preferences and retrieve value of preferences in next activity and refer below links for more information.

共享preferences

这篇关于传递变量从一个类到另一个wiithout使用意图得到额外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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