修复.android文件夹facebook sdk乱七八糟?

时间:2014-01-03 15:05:14

标签: android eclipse facebook facebook-login

我有一个非常严重的问题,我已经被困了将近两个星期。我不确定错误在哪里所以我打算删除与Facebook SDK相关的所有内容。

但是我不确定.android文件夹中还有什么。它的内容是:

.android folder

我可以从eclipse中删除facebook项目并清除该文件夹并重新开始吗?

当我创建调试密钥时,我输入了自己的密码,而不是“android”,因此导致了其他问题。我没有找到任何关于如何更改密码或如何生成新密码的帮助。我尝试删除debug.keystore文件,但问题仍然存在。任何帮助非常感谢。

最后有人知道我在哪里可以找到最近的Facebook login tutorials,在Facebook页面上的那个导致以下问题:

facebook prob

这两个类的完整代码如下:

import java.util.Arrays;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;

import com.facebook.Session;
import com.facebook.SessionState;
import com.facebook.UiLifecycleHelper;
import com.facebook.widget.LoginButton;

public class FBMainFragment extends Fragment{
private static final String TAG = "MainFragment";
private UiLifecycleHelper uiHelper;

private void onSessionStateChange(Session session, SessionState state, Exception exception) {
    if (state.isOpened()) {
        Log.i(TAG, "Logged in...");
    } else if (state.isClosed()) {
        Log.i(TAG, "Logged out...");
    }
}

private Session.StatusCallback callback = new Session.StatusCallback() {
    @Override
    public void call(Session session, SessionState state, Exception exception) {
        onSessionStateChange(session, state, exception);
    }
};

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    uiHelper = new UiLifecycleHelper(getActivity(), callback);
    uiHelper.onCreate(savedInstanceState);
    LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
    authButton.setFragment(this);
    authButton.setReadPermissions(Arrays.asList("user_likes", "user_status"));

    return view;
}
@Override
public void onResume() {
    super.onResume();
 // For scenarios where the main activity is launched and user
    // session is not null, the session state change notification
    // may not be triggered. Trigger it if it's open/closed.
    Session session = Session.getActiveSession();
    if (session != null &&
           (session.isOpened() || session.isClosed()) ) {
        onSessionStateChange(session, session.getState(), null);
    }

    uiHelper.onResume();
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    uiHelper.onActivityResult(requestCode, resultCode, data);
}

@Override
public void onPause() {
    super.onPause();
    uiHelper.onPause();
}

@Override
public void onDestroy() {
    super.onDestroy();
    uiHelper.onDestroy();
}


@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    uiHelper.onSaveInstanceState(outState);
}
}

和:

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

public class FacebookLogIn extends FragmentActivity {

private FBMainFragment mainFragment;
// Your Facebook APP ID
private static String applicationId = "308180782571605"; // Replace your App ID here
private static final String TAG = "FBMainFragment";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState == null) {
        // Add the fragment on initial activity setup
        mainFragment = new FBMainFragment();
        getSupportFragmentManager()
        .beginTransaction()
        .add(android.R.id.content, mainFragment)
        .commit();
    } else {
        // Or set the fragment from restored state info
        mainFragment = (FBMainFragment) getSupportFragmentManager()
        .findFragmentById(android.R.id.content);

    }

}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.facebook_log_in, menu);
    return true;
}


public static String getTag() {
    return TAG;
}


public static String getApplicationId() {
    return applicationId;
}


public static void setApplicationId(String applicationId) {
    FacebookLogIn.applicationId = applicationId;
}

}

0 个答案:

没有答案