use of com.litingzhe.justandroid.netdb.net.adapter.NewsAdapter in project JustAndroid by chinaltz.
the class NetDemoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_news);
ButterKnife.bind(this);
navTitle.setText("科技新闻");
navBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
newsArrayList = new ArrayList();
newsAdapter = new NewsAdapter(newsArrayList, mContext);
newsListView.setAdapter(newsAdapter);
newsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
NewslistBean news = (NewslistBean) newsAdapter.getItem(position);
Intent intent = new Intent();
intent.setClass(mContext, WebViewActivity.class);
intent.putExtra("title", news.getDescription());
intent.putExtra("url", news.getUrl());
startActivity(intent);
}
});
getData();
PullToRefreshView.setPullRefreshEnable(true);
PullToRefreshView.setLoadMoreEnable(false);
PullToRefreshView.setOnHeaderRefreshListener(new AbPullToRefreshView.OnHeaderRefreshListener() {
@Override
public void onHeaderRefresh(AbPullToRefreshView view) {
getData();
}
});
}
Aggregations