报了空指针,不知道为什么

SF不会玩 发布于 2015/05/29 10:50
阅读 730
收藏 0
private void initDeviceTimeListView() {


lvDeviceTimeAdapter = new ListViewNewsAdapter(this, lvTimeDeviceData,
R.layout.news_listitem);


lvTime_footer = getLayoutInflater().inflate(R.layout.listview_footer,
null);
lvTime_foot_more = (TextView) lvTime_footer
.findViewById(R.id.listview_foot_more);
lvTime_foot_progress = (ProgressBar) lvTime_footer
.findViewById(R.id.listview_foot_progress);


lvTime = (PullToRefreshListView) findViewById(R.id.frame_listview_Time);


lvTime.setAdapter(lvDeviceTimeAdapter);


lvTime.setOnItemClickListener(new OnItemClickListener() {


@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
TextView t = (TextView) lvTime.getChildAt(arg2).findViewById(
R.id.news_listitem_tongdao);
UIHelper.showTimeRedirect(Main.this, t.getText().toString());
}
});

lvTime.setOnScrollListener(new AbsListView.OnScrollListener() {
public void onScrollStateChanged(AbsListView view, int scrollState) {

lvTime.onScrollStateChanged(view, scrollState);


// 数据为空--不用继续下面代码了
if (lvTimeDeviceData.isEmpty())
return;


// 判断是否滚动到底部
boolean scrollEnd = false;
try {

if (view.getPositionForView(lvTime_footer) == view.getLastVisiblePosition())
scrollEnd = false;

} catch (Exception e) {
Log.e("onscrollListener", e.toString());
scrollEnd = false;
}


int lvDataState = StringUtils.toInt(lvTime.getTag());

if (scrollEnd && lvDataState == UIHelper.LISTVIEW_DATA_MORE) {
lvTime.setTag(UIHelper.LISTVIEW_DATA_LOADING);
lvTime_foot_more.setText(R.string.load_ing);
lvTime_foot_progress.setVisibility(View.VISIBLE);
// 当前pageIndex
int pageIndex = lvTimeSumData / AppContext.PAGE_SIZE;
loadTimeDeviceData(pageIndex,lvTimdeHandler,UIHelper.LISTVIEW_ACTION_SCROLL);
}
}


public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
lvTime.onScroll(view, firstVisibleItem, visibleItemCount,
totalItemCount);
}
});

lvTime.setOnRefreshListener(new PullToRefreshListView.OnRefreshListener() {
public void onRefresh() {
loadTimeDeviceData( 0, lvTimdeHandler,UIHelper.LISTVIEW_ACTION_REFRESH);
}
});




lvTime.setVisibility(View.GONE);

}


view.getPositionForView(lvTime_footer)报空指针

加载中
0
SF不会玩
SF不会玩
lvVideo.addFooterView(lvVideo_footer);// 添加底部视图 必须在setAdapter前
还是自己发现了
0
返回顶部
顶部