버튼클릭시 리스트추가하고싶은데
장바구니처럼요
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.drinkview);
.
.
ArrayList<ItemEx> list3 = new ArrayList<ItemEx>();
list3.add(new ItemEx(R.drawable.chocolate_muffin, "더블 초콜릿 머핀",
"부드럽고 촉촉한 진한 초콜릿 풍미의 머핀입니다", "1000원"));
ListView listv3 = (ListView) findViewById(R.id.listview3);
listv3.setAdapter(new CustomDataAdapter(this, list3, R.layout.customrow));
list4 = new ArrayList<ItemEx>();
ListView listv4 = (ListView) findViewById(R.id.listview4);
listv4.setAdapter(new CustomDataAdapter(this, list4, R.layout.customrow));
.
.
mTabHost.addTab(mTabHost.newTabSpec("tab_test3")
.setIndicator("상품")
.setContent(R.id.listview3));
mTabHost.addTab(mTabHost.newTabSpec("tab_test4")
.setIndicator("장바구니")
.setContent(R.id.listview4));
.
.
}
public void ListAdd(ArrayList<ItemEx> ex){
//Log.e("1","ListAdd"+a+","+b+","+c+","+d);
list4 = ex;
Log.e("1",list4.get(0).m_strText+","+list4.get(0).m_strText2+","+list4.get(0).m_strText3);
}
로그찍어보면
Log.e("1",list4.get(0).m_strText+","+list4.get(0).m_strText2+","+list4.get(0).m_strText3); 여기까지잘나오는데 리스트 추가가안됍니다.
보여지질 않네요 해결방법좀알려주세요
버튼
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String s1 = edt1.getText().toString();
if (s1.equals("")) {
Toast.makeText(m_con,"수량을 입력해주세요.", Toast.LENGTH_SHORT)
.show();
} else {
Toast.makeText(
m_con,
m_list.get(pos).m_strText + " 주문 신청! "
+ m_list.get(pos).m_strText3 + s1 + "개",
Toast.LENGTH_SHORT).show();
setdialog();//다이얼로그창 가져오기
Log.e("1",m_list.get(pos).m_strText +
m_list.get(pos).m_strText3 + s1);
ArrayList<ItemEx> aa = new ArrayList<ItemEx>();
//aa.remove(0);
aa.add(new ItemEx(m_list.get(pos).m_src, m_list.get(pos).m_strText, m_list.get(pos).m_strText3, s1));
drink dd = new drink();
dd.ListAdd(aa);
}
}




add 하고 나서 adapter.notifyDataSetChanged() 해보세요.