Android:从 Facebook 回调后,我的主要活动将调用哪个状态?
我在我的android项目中使用Facebook sdk,在我的主要活动中有一个登录按钮,单击该按钮将使用户登录Facebook,并且回调返回到主要活动。
一切正常。
现在我想当回调完成时,我需要将该按钮的文本从“登录”更改为“注销”。 我该怎么做?
回调时我的主要活动将被调用什么状态..我的意思是 onResume() 或 onRestart() 或者什么?
请帮我做这个.. 让我明白这怎么可能......
我已经阅读了足够的 Android 生命周期文档和教程......但我仍然找不到做到这一点。
谢谢你, 马尤尔·帕雷克
i am using Facebook sdk in my android project and in my main activity there is a button for Login clicking on that button will make user login to Facebook and the callback return to the Main Activity.
All works Fine.
Now i want when the callback is done, i need to change the Text of that Button from Login to Logout..
how can i do that?
what state will be called of my main activity on call back.. i mean onResume() or onRestart() or what ??
please help me doing this..
and make me understand how can it be possible...
i have read enough documentations and tutorial for Android lifecyle..but still i couldn't find anyway to do this.
Thank You,
Mayur Parekh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,我假设您通过执行以下操作登录 Facebook:
如果身份验证成功,将在您的
DialogListener
上调用onComplete()
方法。另外,在您的Activity
上,我认为onResume()
方法被调用,但是当FacebookDialog
被关闭时,无论什么,都会调用该方法登录成功与否。So I'm assuming you login into facebook by doing something like this:
If authentication was succesfull the
onComplete()
method will be called on yourDialogListener
. Also on yourActivity
I suppose that theonResume()
method is called but this will be called when theFacebookDialog
is dismissed, no matter what the login was sucesfull or not.这是我在按钮单击事件中的主要活动中所做的,这将调用 Facebook 对话框进行登录,如果登录成功后,将执行与登录失败相同的任务。
我是在我的项目中使用默认的 FACEBOOK SDK。
This is what i have done in my main activity inside the button click event this will call the Facebook Dialog for log in and if after that login is success full will do the task same for login fail.
I am using default FACEBOOK SDK in my project.