Monday, August 10, 2015

ViewPager PagerAdapter not updating the View

ViewPager PagerAdapter not updating the View - Hallo sahabat Google Android Developer Tutorial, Pada Artikel yang anda baca kali ini dengan judul ViewPager PagerAdapter not updating the View, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.

Judul : ViewPager PagerAdapter not updating the View
link : ViewPager PagerAdapter not updating the View

Baca juga


ViewPager PagerAdapter not updating the View

http://stackoverflow.com/questions/7263291/viewpager-pageradapter-not-updating-the-view

up vote407down voteaccepted
There are several ways to achieve this.
The first option is easier, but bit more inefficient.
Override getItemPosition in your PagerAdapter like this:
public int getItemPosition(Object object) {
return POSITION_NONE; 
} 
This way, when you call notifyDataSetChanged(), the view pager will remove all views and reload them all. As so the reload effect is obtained.
The second option, suggested by Alvaro Luis Bustamante (previously alvarolb), is to setTag()method in instantiateItem() when instantiating a new view. Then instead of using notifyDataSetChanged(), you can use findViewWithTag() to find the view you want to update.
The second approach is very flexible and high performant. Kudos to alvarolb for the original research.



Demikianlah Artikel ViewPager PagerAdapter not updating the View

Sekianlah artikel ViewPager PagerAdapter not updating the View kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.

Anda sekarang membaca artikel ViewPager PagerAdapter not updating the View dengan alamat link https://googleandroiddevelopertutorial.blogspot.com/2015/08/viewpager-pageradapter-not-updating-view.html

Artikel Terkait

ViewPager PagerAdapter not updating the View
4/ 5
Oleh

Berlangganan

Suka dengan artikel di atas? Silakan berlangganan gratis via email