我如何通过活动之​​间的数据在Android?

编程入门 行业动态 更新时间:2024-10-28 09:29:26
本文介绍了我如何通过活动之​​间的数据在Android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一种情况,通过登录页面登录后,会有一个退出按钮在每个活动。

I have a scenario where, after logging in through a login page, there will be a sign out button on each activity.

在单击signout,我会传球的签约用户的会话ID signout。任何人都可以指导我如何保持会话ID提供给所有的活动??

On clicking signout, I will be passing the session id of the signed in user to signout. Can anyone guide me on how to keep session id available to all activities??

另外,有另一种解决这个问题?

Alternatively, is there another solution to this problem?

推荐答案

这样做将是会话ID传递到您正在使用启动该​​活动的意图signout活动的最简单的方法:

The easiest way to do this would be to pass the session id to the signout activity in the intent you're using to start the activity:

Intent intent = new Intent(getBaseContext(), SignoutActivity.class); intent.putExtra("EXTRA_SESSION_ID", sessionId); startActivity(intent)

借助文档的意图有更多的信息(看标题为其他)。

The docs for Intents has more information (look at the section titled "Extras").

更多推荐

我如何通过活动之​​间的数据在Android?

本文发布于:2023-11-11 04:46:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577419.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!