android长按ListView弹出一个窗口显示选择的item中的内容

publicclassMainActivityextendsActivity{privateListViewlist=null;privateSimpleAdapters... public class MainActivity extends Activity {
private ListView list=null;
private SimpleAdapter sa=null;
private String tag[]={"尕、苯尒陔..","243。吴其值","119。杨勇","6号病床|强迫症","毛孩子","243。邹玄"};
private String tag1[]={"憧憬着下车那","憧憬着下车那.....","下车那......","憧憬着.......","那一刻.......","小孩和
private int pic[] ={R.drawable.list1,R.drawable.list2,R.drawable.list3,R.drawable.list4,R.drawable.list5,R.drawable.list6};
private List<Map<String,String>> map=new ArrayList<Map<String,String>>();
private EditText ed1,ed2;
private TextView tv1,tv2;
private Dialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
for(int i=0;i<tag.length;i++){
Map<String,String> map1 = new HashMap<String,String>();
map1.put("Photo", String.valueOf(pic[i]));
map1.put("Name", tag[i]);
map1.put("Take", tag1[i]);
map.add(map1);
}
sa = new SimpleAdapter(this,map,R.layout.qqlist,new String[]{"Photo","Name","Take"}
,new int[]{R.id.imageView1,R.id.textView1,R.id.textView2});
list = (ListView)findViewById(R.id.listView1);
list.setAdapter(sa);

tv1=(TextView) findViewById(R.id.textView1);
tv2=(TextView) findViewById(R.id.textView2);
ed1=(EditText) findViewById(R.id.editText1);
ed2=(EditText) findViewById(R.id.editText2);
list.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
Map<String, String> mapl=(Map<String, String>) MainActivity.this.sa.getItem(arg2);
String name=mapl.get("Name");
String take=mapl.get("Take");
LayoutInflater flater = LayoutInflater.from(MainActivity.this);
View myView = flater.inflate(R.layout.log, null);
//ed1.setText(name);
//MainActivity.this.ed1.setText(name);
//MainActivity.this.ed2.setText(take);
MainActivity.this.dialog = new AlertDialog.Builder(MainActivity.this)
.setTitle("Login")
//.setMessage(name+"/t"+take)
.setIcon(R.drawable.ic_launcher).setNegativeButton("取消", null)
.setView(myView).create();
dialog.show();
return false;
}
});

}

}

这里读取name和take,已经读出来了,怎么把他们显示在弹出框里的EditText组件ed1和ed2中我这一运行就关闭不知道怎么改
展开
 我来答
鲁步彤霞4v
2014-12-11 · TA获得超过144个赞
知道答主
回答量:111
采纳率:0%
帮助的人:42.7万
展开全部
把你的整个程序发给我 我帮你看下780746477@qq.com
追问
就是象EditText框上面的文字一样把对应的内容放到EditText中
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式