I ask about facebook android sdk Authentication error.
When I rnu the program, it appear an error is “has stopped unexpectedly. Please try again .”
debuge error is about NullPointerException problem.
(facebook-android-sdk / facebook / src / com / facebook / internal / Validate.java)
How can I solve this problem? thanks.
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);
}
}
}
Blockquote
<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"
/>
Blockquote
enter code here
You can try to obtain access token via some web-service and initialize .
you can authorize your session within activity and pass it through binder.
Facebook facebook
Here example.