ListView에서 무조건 맨아래행만 삭제가 됩니다
도대체 왜 그럴까요?
public class ListItem {
public String name = "";
public ListItem(String _name){
this.groupA = _groupA;
}
public String getName() {
return name;
}
public void setName(String Name) {
this.Name = Name;
}
}
public class myPagerAdapter extends PagerAdapter{
private LayoutInflater mInflater;
String[] wordTitle ={"영어", "한자", "일본어", "오답노트", "내단어장"};
String[] wordTitle2 ={"영어2", "한자2", "일본어2", "오답노트2", "내단어장2"};
String[] wordTitle3 ={"영어3", "한자3", "일본어3", "오답노트3", "내단어장3"};
String[] wordTitle4 ={"영어4", "한자4", "일본어4", "오답노트4", "내단어장4"};
ListView wordList;
private final Handler handler = new Handler();
ArrayList<ListItem> list = null;
WordListItemAdapter adapter = null;
Context mContext;
View convertView;
ListItem Item;
public myPagerAdapter(Context context, int cnt) {
super();
mInflater = LayoutInflater.from(context);
mContext = context;
mHelper = new WordDBHelper(context);
this.list = new ArrayList<ListItem>();
adapter = new WordListItemAdapter(mContext, list, R.layout.Title_list_item);
}
// PagerAdapter에서 관리할 View 개수를 반환합니다.
public int getCount() {
return 3;
}
@Override
public int getItemPosition(Object object) {
// TODO Auto-generated method stub
return POSITION_NONE;
}
@Override
// ViewPager에서 사용할 View를 생성하고 등록해줍니다.
public Object instantiateItem(View pager, int position){
convertView = mInflater.inflate(R.layout.title_list, null);
wordList = (ListView)convertView.findViewById(R.id.wordList);
//원본은 position 마다 틀리게 저장함
for(int i=0 ; i<wordTitle.size(); i++)
{
list(new ListItem(wordTitle[i]);
}
adapter.setAdapter(adapter);
wordList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
//무조건 맨아래행만삭제됨
list.remove(arg2);
adapter.notifyDataSetChanged();
});
((ViewPager)pager).addView(convertView, null);
//((ViewPager)pager).getAdapter().notifyDataSetChanged();
return convertView;
}
}