1

I'm using a custom adapter and wrapping it around the cwac-endless adapter. The problem is that the wrapping condition is being ignored and the method inside the cacheInBackground() is being called infinitely. I'm attaching the concerned code.Please suggest me a solution for this. Thank you.

    @Override
        protected boolean cacheInBackground() {
          SystemClock.sleep(100);       // pretend to do work


          try {
            msg=getMsgs();
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ParserConfigurationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SAXException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
          Log.d("count", " "+ getWrappedAdapter().getCount());
          return(getWrappedAdapter().getCount()<100);
        }

        @Override
        protected void appendCachedData() {
          if (getWrappedAdapter().getCount()<100) {
            @SuppressWarnings("unchecked")
         MsgAdapter a=(MsgAdapter)getWrappedAdapter();


          for(String s:msg)
          {
              Log.d("msg", s);
          }

          }
        }
      }
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
Dinesh Venkata
  • 1,087
  • 1
  • 9
  • 22

1 Answers1

0

I fixed the error it had to do with the logic of my getCount() in my custom adapter. Fixing it made the code work perfectly.

Dinesh Venkata
  • 1,087
  • 1
  • 9
  • 22