コード例 #1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.subject);
   Bundle bundle = getIntent().getExtras();
   url = bundle.getString("url");
   itemITeye = new NewItemITeye();
   subjectAdapter = new SubjectAdapter(this);
   mXlistView = (XListView) findViewById(R.id.id_xlistView);
   mXlistView.setPullRefreshEnable(this);
   mXlistView.setPullLoadEnable(this);
   mXlistView.setRefreshTime(AppUtil.getRefreashTime(this, Constant.NEWS_TYPE_SUBJECTS));
   mXlistView.setOnItemClickListener(
       new AdapterView.OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
           NewsItem newsItem = newsItems.get(position - 1);
           String url = newsItem.getLink();
           Intent intent = new Intent(SubjectsActivity.this, NewsContentActivity.class);
           intent.putExtra("url", url);
           intent.putExtra("select", 5);
           startActivity(intent);
         }
       });
   if (isFirstIn) {
     /** 进来时直接刷新 */
     mXlistView.startRefresh();
     isFirstIn = false;
   } else {
     mXlistView.NotRefreshAtBegin();
   }
   mXlistView.setAdapter(subjectAdapter);
 }
コード例 #2
0
 private void onLoad() {
   xList.stopRefresh();
   xList.stopLoadMore();
   SimpleDateFormat df = new SimpleDateFormat(Globals.DATE_FORMAT); // 设置日期格式
   xList.setRefreshTime(df.format(new Date()));
 }