Share Share
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC:

Out of memory using viewpager 10 years 1 month ago #10212

  • vitorpradoveri
  • vitorpradoveri's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 1
  • Thank you received: 0
I've bought the license to use Radaee in Android app.
I need to setup the pdf using a ViewPager, I found the example in RDPDFReader..
But the PDFViewPager throws an out of memory exception after some pages.

I was looking into PDFViewPager implementation and I found an array with the pages, and it's never released by GC.
maybe this is the problem.. I really don't know how can i solve this. I need to implement my own viewpager with my own adapter?

Please Log in or Create an account to join the conversation.

Out of memory using viewpager 10 years 1 month ago #10217

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
can you reproduce this issue with all the pdfs? Can you please send us one of your pdfs to test it..

I invite you to open a new ticket bout that issue here: www.radaeepdf.com/support/tickets

Please Log in or Create an account to join the conversation.

Out of memory using viewpager 10 years 3 weeks ago #10364

  • alolip
  • alolip's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2
  • Thank you received: 0
Is there a solution for this issue?
I'm having it too,
seems like objects are never released

Please Log in or Create an account to join the conversation.

Out of memory using viewpager 10 years 3 weeks ago #10366

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
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.

Please Log in or Create an account to join the conversation.

Out of memory using viewpager 10 years 3 weeks ago #10367

  • alolip
  • alolip's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 2
  • Thank you received: 0
Is there a solution for this issue?
I'm having it too,
seems like objects are never released

Please Log in or Create an account to join the conversation.

Out of memory using viewpager 9 years 10 months ago #10563

  • thiagopelikan
  • thiagopelikan's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 36
  • Thank you received: 0
Same here!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Powered by Kunena Forum