我正在使用自定义适配器并将其包裹在cwac-endless适配器周围。问题是包装条件被忽略并且 cacheInBackground() 中的方法被无限调用。我附上了相关的代码。请为此建议我一个解决方案。谢谢你。
@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);
}
}
}
}