2014-09-26 103 views
0

我想刪除點擊 我創建刪除梅索德已刪除.. 列表視圖項,但是當我點擊按鈕,只像是剛剛裝修一新的未刪除該項目 請告訴我當我在做錯誤的如何從列表視圖中刪除列表視圖項中的Android

Button yes=(Button)convertView.findViewById(R.id.yes); 
     yes.setTag(position); 
     yes.setOnClickListener(new OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       // TODO Auto-generated method stub 
       UserProfile u=new UserProfile(); 

       resultp.remove(data.get(position)); 
        notifyDataSetChanged(); 
       Toast.makeText(context, "yes", Toast.LENGTH_SHORT).show(); 

      } 
     }); 

這裏使用On按鈕我的代碼即時點擊 在這個 resultp是

HashMap<String, String> resultp = new HashMap<String, String>(); 

和數據是rray列表

我會感謝你的答案

+0

發表您的適配器 – Blackbelt 2014-09-26 13:21:35

+1

打開_www.google.com_然後輸入**「如何刪除android中的listview項目「**。你會看到的第一件事是從stackoverflow鏈接的問題。打開並解決你的問題。祝你好運。 – 2014-09-26 13:26:24

回答

0

必須行

resultp.remove(position); 

然後

resultp.notifyDataSetChanged(); 
相關問題