0

I am working with converflow layout Followed as per instructed in given library https://github.com/moondroid/CoverFlow Its perfectly fine when its launched as per what I wan, But the issue is when i tap the screen the app crashed observed in lollipop devices

<---- mainactivity ---->

CoverFlowAdapter adapter = new CoverFlowAdapter(this);

FeatureCoverFlow featureCoverFlow = (FeatureCoverFlow) findViewById(R.id.coverflow);

featureCoverFlow.setAdapter(adapter);

<--xml used -->

<?xml version="1.0" encoding="utf-8"?>
<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"
    xmlns:coverflow="http://schemas.android.com/apk/res-auto">

    <it.moondroid.coverflow.components.ui.containers.FeatureCoverFlow
        android:id="@+id/coverflow"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        coverflow:coverHeight="150dp"
        coverflow:coverWidth="150dp"
        coverflow:maxScaleFactor="1.5"
        coverflow:reflectionGap="0px"
        coverflow:rotationThreshold="0.5"
        coverflow:scalingThreshold="0.5"
        coverflow:spacing="0.6" />

</LinearLayout>

<--CoverFlowAdapter -->

public class CoverFlowAdapter extends BaseAdapter {
    private final ArrayList<String> mListString;
    private LayoutInflater mLayoutInflator;

    public CoverFlowAdapter(MainActivity activity) {
        mLayoutInflator = LayoutInflater.from(activity);
        mListString = new ArrayList<>();
        mListString.add("one");
        mListString.add("two");
        mListString.add("three");
        mListString.add("four");
        mListString.add("five");

    }

    @Override
    public int getCount() {
        return mListString.size();
    }

    @Override
    public String getItem(int position) {
        return mListString.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

            View rowView = convertView;
            if (rowView == null) {
                rowView = mLayoutInflator.inflate(R.layout.cover_flow_item,
                        parent, false);

                ViewHolder viewHolder = new ViewHolder();
                viewHolder.text = (TextView) rowView.findViewById(R.id.label);
                rowView.setTag(viewHolder);
            }

            ViewHolder holder = (ViewHolder) rowView.getTag();
            holder.text.setText(mListString.get(position));

        return rowView ;
    }

    static class ViewHolder {
        public TextView text;

    }
}

<---Getting Error as -->

java.lang.NullPointerException: Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference at android.view.ViewGroup.canViewReceivePointerEvents(ViewGroup.java:2316) at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1581) at android.view.View.dispatchGenericMotionEvent(View.java:8552) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1919) at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1624) at android.view.View.dispatchGenericMotionEvent(View.java:8552) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1919) at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1624) at android.view.View.dispatchGenericMotionEvent(View.java:8552) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1919) at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1624) at android.view.View.dispatchGenericMotionEvent(View.java:8552) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1919) at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1624) at android.view.View.dispatchGenericMotionEvent(View.java:8552) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1919) at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1624) at android.view.View.dispatchGenericMotionEvent(View.java:8552) at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1919) at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1624) at android.view.View.dispatchGenericMotionEvent(View.java:8552) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchGenericMotionEvent(PhoneWindow.java:2377) at com.android.internal.policy.impl.PhoneWindow.superDispatchGenericMotionEvent(PhoneWindow.java:1729) at android.app.Activity.dispatchGenericMotionEvent(Activity.java:2778) at android.support.v7.view.WindowCallbackWrapper.dispatchGenericMotionEvent(WindowCallbackWrapper.java:70) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchGenericMotionEvent(PhoneWindow.java:2344) at android.view.View.dispatchPointerEvent(View.java:8668) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4123) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3989) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3680) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3737) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5807) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5781) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5752) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5897) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:143) at android.os.Looper.loop(Looper.java:122) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.m

witted_coder
  • 161
  • 1
  • 14

0 Answers0