Question

I have an issue in flipperview animation in android , am using flipperview horizontal view animation, arraylist size is 14 but getview calling only 3 times after that getview() is not calling.

The code is:

@SuppressLint({ "NewApi", "SetJavaScriptEnabled" })
public class DetailsActivity extends Activity {

    private FlipViewController flipView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        flipView = new FlipViewController(this, FlipViewController.HORIZONTAL);

        flipView.setAdapter(new BaseAdapter() {

            private WebView mWebview;
            ProgressDialog progressDialog = null;
            List<EventUtil> mEventUtil= GlobalValues.getInstance().eventUtils;
            private int repeatCount = 1;

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                View layout = convertView;
                LayoutInflater inflater= LayoutInflater.from(EventDetailsActivity.this);

                if (convertView == null) {
                    layout = inflater.inflate(R.layout.pf_fragment_event_desc, null);

                    progressDialog = Constants.getInstance().loadingDialog(getParent());

                    EventUtil eventDescEntity = mEventUtil.get(position);

                    Log.d("ARRAYSIZE", mEventUtil.size()+"");
                    mWebview = (WebView)layout.findViewById(R.id.event_detail_web_view);
                    mWebview.getSettings().setJavaScriptEnabled(true);
                    getJsonObject(eventDescEntity.getEvent_id(),mWebview);

                    Log.d("POSISSION", position+"");
                }

                return layout;
            }

            @Override
            public long getItemId(int position) {

                return position;
            }

            @Override
            public Object getItem(int position) {

                return position;
            }

            @Override
            public int getCount() {

                return mEventUtil.size() * repeatCount;
            }
        });

        setContentView(flipView);
    }

    @Override
    protected void onResume() {

        super.onResume();
        flipView.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        flipView.onPause();
    }
}

it's working fine, the problem is when getview count reached to 3 after that getView() method is not calling

log

position 0
position 1
position 2

count is not increasing plase hlep me.

Was it helpful?

Solution

Try

if (convertView == null) {
    layout = inflater.inflate(R.layout.pf_fragment_event_desc, parent, false);
}

Your code puts the information only when the convertView is null

(Note: You know here what the items parent is going to be (the ViewGroup parent argument) so you should tell the inflater this by using inflate(id, parent, false); rather than inflate(id, null); - you should almost never be calling inflate(id, null))

see more in;

Layout inflate documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top