This project is an upgraded version of ViewPager. AutoNotifies your adapter when data get's changed.
##Prerequisites
- By default ViewPager's
adapter
should be notified using mAdapter.notifyDataSetChanged() if data get's changed after setting adapter to avoid IllegalStateException - It get's difficult to update your adapter when
PagerAdapter
is in other class, typically different *.java - Example :
- In this app,
ListView's adapter
&ViewPager's adapter
share's same content. - When scrolled down to bottom of the page in ListView,
GetMoreData
is triggered, fetched, parsed & updated to ListView's adapter. - Seems easy, but when the user clicks & navigates to
ViewPager
after triggered and before updated, you end up inIllegalStateException
as the data got changed but not notified. - This can be avoided having complex
eventListeners
, instead simply use AutoNotifyViewPager
- In this app,
- Notifies your
adapter
when view get's changed
adapter
get's content.
Import any one *.jar into /libs
In layout.xml
<com.venomvendor.library.AutoNotifyViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Instead of use AutoNotifyViewPager mPagerViewPager mPager
AutoNotifyViewPager mPager = (AutoNotifyViewPager) findViewById(R.id.pager);
mPager.setAdapter(adapter);
import com.venomvendor.library.AutoNotifyViewPager.*;
import android.support.v4.view.ViewPager.*
-dontwarn com.venomvendor.library.AutoNotifyViewPager.**
-keep public class com.venomvendor.library.AutoNotifyViewPager.** { *; }
Author : VenomVendor
#License Copyright (C) 2015 VenomVendor info@VenomVendor.com Copyright (C) 2011 The Android Open Source Project.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.