Dinesh Venkata
Dinesh Venkata

Reputation: 1087

Error in wrapping a custom adapter around cwac-endless adapter

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);
          }

          }
        }
      }

Upvotes: 1

Views: 309

Answers (1)

Dinesh Venkata
Dinesh Venkata

Reputation: 1087

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.

Upvotes: 0

Related Questions