Kinvey数据正在RecyclerView中加载

时间:2016-03-25 00:12:03

标签: android android-recyclerview kinvey

我的RecyclerView出了问题。我试图用朋友名字列表填充它,但是当我启动我的片段时,朋友没有被加载。另一方面,如果我进入调试模式,则会加载好友。

我的代码:

   @Override
   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mKinveyClient = KinveyUtils.getClient(getContext());
    mFriends = getUserFriends();

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_friend_list, container, false);


    // Set the adapter
  if (view instanceof RecyclerView) {
        Context context = view.getContext();
      mRecyclerView = (RecyclerView) view;
      mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
      mRecyclerView.setAdapter(new FriendRecyclerViewAdapter(mFriends));
    }
    return view;
}

 private ArrayList<ArrayMap> getUserFriends() {
    return (ArrayList<ArrayMap>) mKinveyClient.user().get(KinveyConstants.FRIENDS);
}

我觉得朋友加载速度太慢,但此时所有需要的数据应该已经在app中。知道怎么解决吗?

0 个答案:

没有答案