我询问 facebook android sdk 身份验证错误。
当我运行程序时,出现错误“已意外停止。请重试。”
调试错误是关于 NullPointerException 问题。(facebook-android-sdk/facebook/src/com/facebook/internal/Validate.java)
我怎么解决这个问题?谢谢。
package com.example.fbloginau;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
public class MainFragment extends FragmentActivity
{
private Fragment Fragment;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
// Add the fragment on initial activity setup
Fragment = new Fragment();
getSupportFragmentManager()
.beginTransaction()
.add(android.R.id.content, Fragment)
.commit();
}
else
{
// Or set the fragment from restored state info
Fragment = (Fragment) getSupportFragmentManager()
.findFragmentById(android.R.id.content);
}
}
}
块引用
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.facebook.widget.LoginButton
android:id="@+id/authButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
/>
块引用
enter code here