Question

data is changed on scroll list which data i have added to relative layout.

@Override
    public View getView(int paramInt, View paramView,ViewGroup paramViewGroup) {
        View localView = paramView;
        MyCustomHolder holder = null;
        if (localView == null) {
            LayoutInflater inflater = (LayoutInflater) CopyOfHistory.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            localView = inflater.inflate(R.layout.copyhistorylist, null);
            holder = new MyCustomHolder();
            holder.coffeeShopName = (TextView) localView.findViewById(R.id.hlcoffeeshopname);
            holder.coffeeshopid = (TextView) localView.findViewById(R.id.hlcoffeeshopid);
            localView.setTag(holder);
            int looplimit = Integer.parseInt(TAG_TOTAL.get(paramInt));
            for (int i = 0; i < looplimit; i++) {
                Log.e("loop", String.valueOf(looplimit));
                final ImageView imageView = new ImageView(CopyOfHistory.this);
                if (i < Integer.parseInt(TAG_COUNT.get(paramInt))) {
                    imageView.setImageDrawable(getResources().getDrawable(R.drawable.ii));
                } else {
                    imageView.setImageDrawable(getResources().getDrawable(R.drawable.iii));
                }
                imageView.setTag(i);
                layout = (RelativeLayout) localView.findViewById(R.id.hlrlayout);
                RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(30,30);
                params.setMargins(i*40, 0, 0, 0);
                imageView.setLayoutParams(params);
                layout.setTag(paramInt);
                layout.addView(imageView);
                //holder.relativeLayout = new RelativeLayout();


            }

        } else {
            holder = (MyCustomHolder) localView.getTag();
   layout.getTag(paramInt);

        }
        holder.coffeeShopName.setText(TAG_COFFEESHOP_NAME.get(paramInt));
        holder.coffeeshopid.setText(TAG_ID.get(paramInt));


        holder.coffeeShopName.setFocusable(false);
        holder.coffeeShopName.setFocusableInTouchMode(false);
        return localView;

    }
Was it helpful?

Solution

you should have to remove checking if(localView == null) { }else { }

just remove this and problem will solved

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top