2

i want display FriendPickerFragment in other fragment but i get empty list please help i cant find any info about thay

this is layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<FrameLayout
    android:id="@+id/friend_picker_fragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

</LinearLayout>

and this is code of fragment

public class HomeFragment extends Fragment {

public static final Uri FRIEND_PICKER = Uri.parse("picker://friend");
private FriendPickerFragment friendPickerFragment;
private static final String TAG = "MainFragment";

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View rootView = inflater.inflate(R.layout.home_fragment, container,
            false);

    FragmentManager manager = getActivity().getSupportFragmentManager();
    Fragment fragmentToShow = null;

    friendPickerFragment = new FriendPickerFragment();
    friendPickerFragment
            .setOnErrorListener(new PickerFragment.OnErrorListener() {
                @Override
                public void onError(PickerFragment<?> fragment,
                        FacebookException error) {
                    Toast.makeText(getActivity(), error.getMessage(),
                            Toast.LENGTH_SHORT).show();
                }
            });
    friendPickerFragment
            .setOnDoneButtonClickedListener(new PickerFragment.OnDoneButtonClickedListener() {
                @Override
                public void onDoneButtonClicked(PickerFragment<?> fragment) {
                    Toast.makeText(getActivity(), "Done",
                            Toast.LENGTH_SHORT).show();
                }
            });
    fragmentToShow = friendPickerFragment;

    manager.beginTransaction()
            .replace(R.id.friend_picker_fragment, fragmentToShow).commit();

    return rootView;
}

@Override
public void onStart() {
    super.onStart();
    try {
        friendPickerFragment.loadData(false);
    } catch (Exception ex) {
    }
}

    }
Mariusz
  • 1,352
  • 1
  • 16
  • 31
  • what you mean in other fragment, did you get facebook friends success? – NoXSaeeD May 27 '14 at 10:21
  • i mean that i got main activity that host fragment and in that fragment i want place FriendPickerFragment, i got nice facebook style top bar but the list is empty – Mariusz May 27 '14 at 10:28

1 Answers1

3

Facebook has released their new sdk recently to enhance the level of security purpose. The following are the few requirement to use facebook sdk in your app.

check this points first!!

  1. The app should send for the submission and needs to get approval from facebook team to use facebook integration in your own app for listing friends details, accessing locations and to access other special permissions The approval formalities are similar like store listing app in the google play.

  2. The application must be listed in the google play or you could able to integrate it as a test user(i.e like beta testing in google play).

  3. The application should have a proper package name, launching activity, domain name, website url and email.

  4. The app id registered must match with a app name and hash key must be generated for a user developing with different machines

  5. The sample screenshots of the application, description, and app logo needs to be added

  6. Once after the successful approval from the team it will show a active symbol near your app name.

Hope this help!!!

NoXSaeeD
  • 924
  • 1
  • 7
  • 13
  • you have partial right :) its cus FB change security in new SDK how ever its just print friend that also accept my app – Mariusz Jun 24 '14 at 12:51