Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viewpager viewpageradapter use crash #70

Open
qssq666123 opened this issue Jan 20, 2017 · 2 comments
Open

viewpager viewpageradapter use crash #70

qssq666123 opened this issue Jan 20, 2017 · 2 comments

Comments

@qssq666123
Copy link

a.lang.NullPointerException: Attempt to invoke virtual method 'android.support.v7.widget.RecyclerView$LayoutManager android.support.v7.widget.RecyclerView.getLayoutManager()' on a null object reference
at xyz.danoz.recyclerviewfastscroller.calculation.progress.VerticalLinearLayoutManagerScrollProgressCalculator.calculateScrollProgress(VerticalLinearLayoutManagerScrollProgressCalculator.java:25)
at xyz.danoz.recyclerviewfastscroller.AbsRecyclerViewFastScroller.onLayout(AbsRecyclerViewFastScroller.java:206)
at android.view.View.layout(View.java:16653)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080)
at android.view.View.layout(View.java:16653)
at android.view.ViewGroup.layout(ViewGroup.java:5438)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16653)

@qssq666123
Copy link
Author

recyclerView = ((SwipeMenuRecyclerView) findViewById(R.id.recyclerview));
recyclerView.addItemDecoration(new ListDividerItemDecoration(AppContext.getInstance(), R.drawable.shape_divider));//HORIZONTAL_LIST
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(AppContext.getInstance());
recyclerView.setLayoutManager(linearLayoutManager);
adapter = new VoiceAdapter();
fastScroller = (VerticalRecyclerViewFastScroller) findViewById(R.id.fast_scroller);
recyclerView.setAdapter(adapter);
fastScroller.setRecyclerView(recyclerView);
recyclerView.addOnScrollListener(fastScroller.getOnScrollListener());
swipeRefreshLayout = ((SwipeRefreshLayout) findViewById(R.id.swiperefresh));
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(AppContext.getInstance().getResources().getColor(R.color.theme_color));
swipeRefreshLayout.setColorSchemeColors(ContextCompat.getColor(AppContext.getInstance(), android.R.color.white));
recyclerView.setSwipeMenuCreator(VoiceUtils.getVoiceSwipeMenuCreator(AppContext.getInstance()));
// 设置菜单Item点击监听。
recyclerView.setSwipeMenuItemClickListener(menuItemClickListener);

    swipeRefreshLayout.setOnRefreshListener(new android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            queryData();
        }
    });

    adapter.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(ViewGroup parent, View view, int position) {
            VoiceUtils.setAdapaterCurrentPosition(adapter, position);

// evPathFrom.setText(adapter.getData().get(position).getPath().getAbsolutePath());
}
});

@liya7907
Copy link

liya7907 commented Aug 1, 2017

hi budy,did you fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants