“我正在尝试在我的子项中为FAQ屏幕显示数据,但出现错误”我收到有关IDNA信息和mcontext的错误
MainActivity
for (Feed feed : Utils.loadFeeds(this.getApplicationContext())) {
mExpandableView.addView(new HeadingView(mContext, feed.getHeading()));
for (Info info : feed.getInfoList()) {
mExpandableView.addView(new InfoView(mContext, info));
}
}*/
// setLoadMoreListener(mExpandableView);
}
private void setLoadMoreListener(ExpandablePlaceHolderView expandableView) {
mOnScrollListener =
new PlaceHolderView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
ExpandablePlaceHolderView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if(layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
int totalItemCount = linearLayoutManager.getItemCount();
int lastVisibleItem = linearLayoutManager.findLastVisibleItemPosition();
if (!mIsLoadingMore
&& !mNoMoreToLoad
&& totalItemCount > 0
&& totalItemCount == lastVisibleItem + 1) {
mIsLoadingMore = true;
new Handler(Looper.getMainLooper())
.post(new Runnable() {
@Override
public void run() {
// do api call to fetch data
// example of loading from file:
for(Feed feed : Utils.loadFeeds(getApplicationContext())){
mExpandableView.addView(new HeadingView(mContext, feed.getHeading()));
//for (Map.Entry<String, List<Treet>> entry : treetsByAuthor.entrySet()){
for(Info info : feed.getInfoList()) {
mExpandableView.addView(new InfoView(mContext, info));
}
}
mIsLoadingMore = false;
}
});
}
}
}
};
expandableView.addOnScrollListener(mOnScrollListener);
}
}
for(Feed feed : Utils.loadFeeds(getApplicationContext())){
mExpandableView.addView(new HeadingView(mContext, feed.getHeading()));
//for (Map.Entry<String, List<Treet>> entry : treetsByAuthor.entrySet()){
for(Info info : feed.getInfoList()) {
mExpandableView.addView(new InfoView(mContext, info));
}
}
mIsLoadingMore = false;
}
});
错误 错误:for-each不适用于表达式类型 必需:数组或java.lang.Iterable 找到:信息