private void loadFromCache() { // TODO Auto-generated method stub File f = new File(cacheArticlesPath); if (!f.exists()) { loadArticles(); return; } try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f)); Object obj = ois.readObject(); List<Article> articles = (List<Article>) obj; mAdapter.getList().clear(); mAdapter.addAll(articles); ois.close(); } catch (StreamCorruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { // TODO Auto-generated method stub position = position - 1; // mListView.getHeaderViewsCount(); if (position <= -1 || position >= mAdapter.getList().size()) { return; } // 弹出操作菜单 showMenu(mAdapter.getList().get(position), position, arg1); }