Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 该活动不会返回到上一个活动(使用facebook sdk)_Android_Facebook_Android Intent_Fragment - Fatal编程技术网

Android 该活动不会返回到上一个活动(使用facebook 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

我使用facebook sdk允许用户使用他们的facebook帐户登录我的应用程序,我使用一个片段在登录访问后启动其他活动,它工作正常。问题是,此活动不会回到上一个活动。FacebookSDK4.0使用了SDK中实现的另一个活动,它处理登录,是否与此问题有关。 我正在使用的代码:

@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);
}