【发布时间】:2012-01-24 18:56:39
【问题描述】:
运行 android 应用程序时出现这些错误:
我没有获得状态,而是获得了一种状态,即“JSON EXCEPTON”。 我也在 elogcat 中遇到了这些错误。
01-22 15:39:09.783:E/Twitter(468):检索推文时出错 01-22 15:39:09.783: E/Twitter(468): 404: 请求的 URI 无效或请求的资源(例如用户)不存在。 01-22 15:39:09.783: E/Twitter(468): {"error":"Not found","request":"/1/null/lists/0/statuses.json?page=1"}
这段代码运行良好。但是然后我将图标放在我的列表视图上(显示状态之前的菜单...)。我在这里的某个地方遇到了错误:
有什么想法吗?
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Activity activity = (Activity) getContext();
LayoutInflater inflater = activity.getLayoutInflater();
// Inflate the views from XML
View rowView = inflater.inflate(R.layout.image_text_layout, null);
JSONObject jsonImageText = getItem(position);
ImageView imageview =(ImageView)rowView.findViewById(R.id.last_build_stat);
try {
String date = (String)jsonImageText.get("tweetDate");
String avatar = (String)jsonImageText.get("avatar");
imageview.setImageBitmap(getBitmap(avatar));
} catch (JSONException e) {
e.printStackTrace();
}
// Set the text on the TextView
TextView textView = (TextView) rowView.findViewById(R.id.job_text);
try {
String tweet = (String)jsonImageText.get("tweet");
String auth = (String)jsonImageText.get("author");
//String date = (String)jsonImageText.get("tweetDate");
if (date.length()>0){
String latest = tweet + "<br><br><i>" + auth + " - " + date + "</i>";
//String latest = tweet;
textView.setText(Html.fromHtml(latest));
} else {
textView.setText(Html.fromHtml(tweet) + "\n" + Html.fromHtml(auth));
}
} catch (JSONException e) {
textView.setText("JSON Exception");
}
【问题讨论】: