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

由网友(听风说爱你)分享简介:我有一种情况,通过登录页面登录后,会有一个退出按钮在每个活动。I have a scenario where, after logging in through a login page, there will be a sign out button on each activity.在单击signout,我会传...

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

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").

阅读全文

相关推荐

最新文章