NOTE: attach of thread 'Binder Thread #3' 错误

gaohongijj 2012-04-04 03:25:42
本人写了个ListView的测试程序,但最终结果显示不出来,用logcat提示:
04-04 07:14:26.308: INFO/AndroidRuntime(337): NOTE: attach of thread 'Binder Thread #3' failed
04-04 07:14:28.218: INFO/ActivityManager(60): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=gao.ListView/.ListViewTest }
04-04 07:14:28.278: INFO/AndroidRuntime(345): NOTE: attach of thread 'Binder Thread #3' failed
我写的代码如下:
ListViewTest.java代码:
(1)package gao.ListView;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.SimpleAdapter;

public class ListViewTest extends ListActivity {

public void onCreate(Bundle savedInstanceState, String gao) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayList< HashMap<String,String>> list = new ArrayList< HashMap<String,String>>();
HashMap<String,String> map1 = new HashMap<String, String>();
HashMap<String,String> map2 = new HashMap<String,String>();
HashMap<String,String> map3 = new HashMap<String,String>();
map1.put("user_name", "gao");
map1.put("user_ip","192.168.0.1");
map2.put("user_name", "yang");
map2.put("user_ip", "192.168.0.2");
map3.put("user_name","li");
map3.put("uaer-ip","192.168.0.3");
list.add(map1);
list.add(map2);
list.add(map3);
SimpleAdapter listAdapter=new SimpleAdapter(this, list, R.layout.user,
new String[]{"user_name","user_ip"},
new int[]{R.id.user_name,R.id.user_ip});
setListAdapter(listAdapter);
}

}

(2)main.xml代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:id="@+id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="vertical"
></ListView>
</LinearLayout>

(3)user.xml的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10pt"
android:singleLine="true"
></TextView>

<TextView
android:id="@+id/user_ip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10pt"
android:gravity="right"
></TextView>

</LinearLayout>

小弟初学android,,请各位大侠帮忙,,,
...全文
546 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kwapoong 2012-04-21
  • 打赏
  • 举报
回复
because your ListViewTest extends ListActivity, you should make sure the id of ListView in main.xml is "@android:id/list" not "@+id/android:list"
b87936260 2012-04-09
  • 打赏
  • 举报
回复
没看出有什么问题,程序崩溃了没?还是只是一片漆黑?贴更多log看看!

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧