From 25485ae7fb0e60211cd45bf22ff0c1b6b882df5d Mon Sep 17 00:00:00 2001 From: fenjuly Date: Wed, 1 Oct 2014 19:48:05 +0800 Subject: [PATCH] fix small bug --- .../java/org/qinshuihepan/bbs/ui/MyPostsActivity.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/qinshuihepan/bbs/ui/MyPostsActivity.java b/app/src/main/java/org/qinshuihepan/bbs/ui/MyPostsActivity.java index c764b5a..586de7c 100644 --- a/app/src/main/java/org/qinshuihepan/bbs/ui/MyPostsActivity.java +++ b/app/src/main/java/org/qinshuihepan/bbs/ui/MyPostsActivity.java @@ -139,7 +139,11 @@ protected ArrayList doInBackground(String... params) { title = a.text(); } Elements xg1s = bm_c.getElementsByClass("xg1"); - comment_count = xg1s.text().substring("回".length()); + if(xg1s.text().length() != 0) { + comment_count = xg1s.text().substring("回".length()); + } else { + comment_count = "0"; + } post = new Post(0, tid, 0, title, "", time, haveimg, Integer.valueOf(comment_count), author, null); posts.add(post); } @@ -152,6 +156,9 @@ protected ArrayList doInBackground(String... params) { @Override protected void onPostExecute(ArrayList posts) { super.onPostExecute(posts); + if(posts.size() == 1) { + posts.clear(); + } myPostsAdapter = new MyPostsAdapter(mContext, posts, mListView); mListView.setAdapter(myPostsAdapter); }