hi, u maybe using old version.
plz check codes for PDFViewPager class, there are implment codes for PagerAdapter:
private class PDFPageAdapter extends PagerAdapter
{
private Document m_doc;
public PDFPageAdapter(Context ctx, Document doc)
{
m_thread = new VThread(m_hand_ui);
m_thread.start();
m_thread_cache = new VThread(m_hand_ui);
m_thread_cache.start();
int cnt = doc.GetPageCount();
m_pages = new PDFPageView[cnt];
m_doc = doc;
int cur;
for(cur = 0; cur < cnt; cur++)
{
m_pages[cur] = new PDFPageView(ctx);
//m_pages[cur].vOpen(m_thread, m_thread_cache, doc, cur, m_fit_type);
}
}
@Override
public java.lang.Object instantiateItem(android.view.ViewGroup container, int position)
{
if(!m_pages[position].vIsOpened())//lazy loading.
m_pages[position].vOpen(m_thread, m_thread_cache, m_doc, position, m_fit_type);
container.addView(m_pages[position]);
return m_pages[position];
}
@Override
public int getCount()
{
return m_pages.length;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object)
{
m_pages[position].vFreeCache();
container.removeView(m_pages[position]);
}
@Override
public boolean isViewFromObject(View view, Object o)
{
return view == o;
}
@Override
public CharSequence getPageTitle(int position)
{
return "Page:" + position;
}
}
callback method destroyItem shall free memories.