I am using a view pager adapter inside a custom adapter. It is used for displaying content in a listview. I am able to display the data in each cell initially. But when I am scrolling the listview, application crashes.
Exception is:
fatal error : Unable to find resource ID #0x1
This is the getView method of my custom adapter:
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
rowData= getItem(position);
ViewHolder viewHolder = null;
if (convertView == null)
{
convertView = mInflater.inflate(rs1, null);
viewHolder = new ViewHolder();
viewHolder.v1 = (ViewPager) convertView.findViewById(R.id.pagerMyFriendHabits);
viewHolder.v1.setId(rowData.mId);
convertView.setTag(viewHolder);
convertView.setTag(R.id.pagerMyFriendHabits, viewHolder.v1);
}
else
{
viewHolder = (ViewHolder) convertView.getTag();
}
Bundle tempBundle[]=new Bundle[rowData.mUrl.length];
for(int i=0;i<rowData.mUrl.length;i++)
{
tempBundle[i]=new Bundle();
tempBundle[i].putString("image_url",rowData.mUrl[i]);
tempBundle[i].putString("product_id",String.valueOf(rowData.mProductId));
tempBundle[i].putBoolean("isFav",rowData.isFav);
}
MyProfile_ViewPager_Adapter tempMyFriendPagerAdapter = new MyProfile_ViewPager_Adapter(mTransaction,tempBundle,rowData.mUrl.length);
viewHolder.v1.setAdapter(tempMyFriendPagerAdapter);
return convertView;
}
Exception is happening in this line:
viewHolder.v1.setAdapter(tempMyFriendPagerAdapter);
I have searched about this issue and got a hint that it has something to do with this line of code:
viewHolder.v1.setId(rowData.mId);
Please help me to find a solution for this issue.
0 comments:
Post a Comment