Android 该活动不会返回到上一个活动(使用facebook sdk)
我使用facebook sdk允许用户使用他们的facebook帐户登录我的应用程序,我使用一个片段在登录访问后启动其他活动,它工作正常。问题是,此活动不会回到上一个活动。FacebookSDK4.0使用了SDK中实现的另一个活动,它处理登录,是否与此问题有关。 我正在使用的代码:Android 该活动不会返回到上一个活动(使用facebook sdk),android,facebook,android-intent,fragment,Android,Facebook,Android Intent,Fragment,我使用facebook sdk允许用户使用他们的facebook帐户登录我的应用程序,我使用一个片段在登录访问后启动其他活动,它工作正常。问题是,此活动不会回到上一个活动。FacebookSDK4.0使用了SDK中实现的另一个活动,它处理登录,是否与此问题有关。 我正在使用的代码: @Override public void onResume() { super.onResume(); profileTracker.startTracking(); tokenTracke
@Override
public void onResume() {
super.onResume();
profileTracker.startTracking();
tokenTracker.startTracking();
Profile profile = Profile.getCurrentProfile();
if (profile != null) {
Intent intent = new Intent(getActivity(), PlayingActivity.class);
getActivity().startActivity(intent);
}
}
不要在onResume中启动活动,因为每次返回活动时,都会调用onResume,如果配置文件不为null,则会启动PlayingActivity
将以下代码移到其他位置
Profile profile = Profile.getCurrentProfile();
if (profile != null) {
Intent intent = new Intent(getActivity(), PlayingActivity.class);
getActivity().startActivity(intent);
}