Question

I've been scouring throug the examples and tutorials but I can't seem to get my head around how to handle recycling within a subclassed SimpleCursorAdapter. I know that for regular ArrayAdapters you can check convertView for null and inflate if null from the xml and if not null, recycle, but I'm having a little trouble visualizing how that works with the from and to arrays within the SimpleCursorAdapter subclass. I tried to figure this out from the The Busy Coders Guide to Android Development by Commonsware but was unsuccessful. If anyone knows of any tips, examples, or tutorials, I would be grateful to see them.

Was it helpful?

Solution

I was unable to find any good examples for Subclassing the SimpleCursorAdapter to use the convertView recycle methodolgy so I ended up subclassing CursorAdapter instead. This actually worked quite well for my implementation and is blazing fast with a dramatic decrease in memory usage. Recycling views really works and I recommend it highly!

Here is an example of my implementation:

 private static class MyNiftyAdapter extends CursorAdapter
    {
        private LayoutInflater mInflater;
        private Cursor cur;

        public MyNiftyAdapter(Context context, Cursor c) {
            super(context,c);       
            this.mInflater = LayoutInflater.from(context);
            this.cur = c;
        }
        public MyNiftyAdapter(Context context, Cursor c, boolean autoRequery)
        {
            super(context, c, autoRequery);
            this.mInflater = LayoutInflater.from(context);
            this.cur = c;
        }
        @Override
        public View getView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder viewHolder;
            if(convertView == null)
            {
                convertView = this.mInflater.inflate(R.layout.chamber_item, null);
                viewHolder = new ViewHolder();
                viewHolder.name = (TextView)convertView.findViewById(R.id.Name);
                viewHolder.city = (TextView)convertView.findViewById(R.id.city);
                viewHolder.state = (TextView)convertView.findViewById(R.id.state);
                viewHolder.country = (TextView)convertView.findViewById(R.id.country);
                convertView.setTag(viewHolder);
            }else
            {
                viewHolder = (ViewHolder)convertView.getTag();
            }
            this.cur.moveToPosition(position);

            viewHolder.name.setText(this.cur.getString(this.cur.getColumnIndex(MyDBHelper.NAME)));          
            viewHolder.city.setText(this.cur.getString(this.cur.getColumnIndex(MyDBHelper.CITY)));
            viewHolder.state.setText(this.cur.getString(this.cur.getColumnIndex(MyDBHelper.STATE)));
            viewHolder.country.setText(this.cur.getString(this.cur.getColumnIndex(MyDBHelper.COUNTRY)));            

            return convertView;
        }
        /* (non-Javadoc)
         * @see android.widget.CursorAdapter#bindView(android.view.View, android.content.Context, android.database.Cursor)
         */
        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            // Dont need to do anything here

        }
        /* (non-Javadoc)
         * @see android.widget.CursorAdapter#newView(android.content.Context, android.database.Cursor, android.view.ViewGroup)
         */
        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {
            // Dont need to do anything here either
            return null;
        }

        static class ViewHolder
        {
            TextView name;
            TextView city;
            TextView state;
            TextView country;
        }
    }

Each row in my list now displays name, city, state, and country exactly as I wanted. Hope this helps.

OTHER TIPS

CursorAdapter does the work partially for you. You only need to override newView() when a new view needs to be created, and bindView() when an existing view is recycled.

import java.util.ArrayList;

import android.content.Context; import android.database.Cursor; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CursorAdapter; import android.widget.ImageView; import android.widget.TextView;

public class AccountsAdapter extends CursorAdapter {

 public static final String TAG = AccountsAdapter.class.getSimpleName();

 private Boolean DEBUG=true;
 private LayoutInflater mInflater;
 private int layoutResource;
 private Cursor mCursor;
 private int acctInd;
 private int upicInd;
 private  ViewHolder holder;
 public AccountsAdapter(Context context,Cursor c,int resourceId) {
     super(context,c);
     this.mCursor=c;
     acctInd=mCursor.getColumnIndex(LJDB.KEY_JOURNALNAME);
     upicInd=mCursor.getColumnIndex(LJDB.KEY_DEFAULTUSERPIC);

     this.layoutResource=resourceId;
     this.mInflater = LayoutInflater.from(context);
 }


 private static class ViewHolder {
     ImageView userpic;
     TextView journalname;
 }

@Override public void bindView(View view, Context context, Cursor cursor) { holder = (ViewHolder) view.getTag(); holder.journalname.setText(cursor.getString(acctInd)); holder.userpic.setTag(cursor.getString(upicInd));

} @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View v = mInflater.inflate(layoutResource, null); holder = new ViewHolder(); holder.userpic = (ImageView) v.findViewById(R.id.duserpic); holder.journalname = (TextView) v.findViewById(R.id.uname);

v.setTag(holder); return v;

} }

You could also subclass ResourceCursorAdapter. In that case you only need to override the bindview method:

public class MySimpleCursorAdapter extends ResourceCursorAdapter {

public MySimpleCursorAdapter(Context context, Cursor c) {
    super(context, R.layout.myLayout, c);
}

@Override
public void bindView(View view, Context context, Cursor cursor) {
    ViewHolder viewHolder = (ViewHolder) view.getTag();
    if (viewHolder == null) {
        viewHolder = new ViewHolder(view);
        view.setTag(viewHolder);
    }
    viewHolder.bind(cursor, context);
}

/**
 * A ViewHolder keeps references to children views to avoid unnecessary calls
 * to findViewById() on each row (especially during scrolling)
 */
private static class ViewHolder {
    private TextView text;

    private ToggleButton toggle;

    public ViewHolder(View view) {
        text = (TextView) view.findViewById(R.id.rowText);
        toggle = (ToggleButton) view.findViewById(R.id.rowToggleButton);
    }

    /**
     * Bind the data from the cursor to the proper views that are hold in
     * this holder
     * @param cursor
     */
    public void bind(Cursor cursor, Context context) {
        toggle.setChecked(0 != cursor.getInt(cursor.getColumnIndex("ENABLED")));
        text.setText(cursor.getString(cursor.getColumnIndex("TEXT")));
    }
}

}

Based on my testing, it appears that the accepted answer is incorrect (more so, unnecessary).

From what I can tell (based on a simple Log.e output test), view recycling is correctly handled by default (as @Romain Guy stated). Which I think would justify there being no recommendation for you to need to override getView() in any documentation I have come across.

This was the code snippet used in the simple example I used to come to this conclusion:

public class MediaAdapter extends CursorAdapter {

    @Override
    public void bindView(View arg0, Context arg1, Cursor arg2) {
        Log.e("bindView", "Called: " + arg2.getPosition());
        ImageView iv = (ImageView) arg0;
        iv.setImageDrawable(new BitmapDrawable(getResources(), MediaStore.Images.Thumbnails.getThumbnail(arg1.getContentResolver(), 
                arg2.getInt(arg2.getColumnIndex(MediaStore.Images.Media._ID)), MediaStore.Images.Thumbnails.MICRO_KIND, null)));

    }

    @Override
    public View newView(Context arg0, Cursor arg1, ViewGroup arg2) {
        Log.e("newView", "Called: " + arg1.getPosition());
        ImageView iv = new ImageView(ctFrag);
        iv.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, 96));
        iv.setPadding(Spine.getDp(2), Spine.getDp(2), Spine.getDp(2), Spine.getDp(2));

        return iv;
    }

}

When using this in a GridView to display a grid of Image thumbnails available the LogCat output was the following:

06-11 21:50:09.906: E/newView(3192): Called: 0
06-11 21:50:09.906: E/bindView(3192): Called: 0
06-11 21:50:09.929: E/bindView(3192): Called: 0
06-11 21:50:09.937: E/bindView(3192): Called: 0
06-11 21:50:09.945: E/bindView(3192): Called: 0
06-11 21:50:09.953: E/bindView(3192): Called: 0
06-11 21:50:09.968: E/bindView(3192): Called: 0
06-11 21:50:09.984: E/bindView(3192): Called: 0
06-11 21:50:10.000: D/dalvikvm(3192): GC_CONCURRENT freed 555K, 5% free 14670K/15303K, paused 1ms+6ms
06-11 21:50:10.023: E/bindView(3192): Called: 0
06-11 21:50:10.031: E/bindView(3192): Called: 0
06-11 21:50:10.047: E/newView(3192): Called: 1
06-11 21:50:10.047: E/bindView(3192): Called: 1
06-11 21:50:10.062: E/newView(3192): Called: 2
06-11 21:50:10.062: E/bindView(3192): Called: 2
06-11 21:50:10.070: E/newView(3192): Called: 3
06-11 21:50:10.070: E/bindView(3192): Called: 3
06-11 21:50:10.078: E/newView(3192): Called: 4
06-11 21:50:10.078: E/bindView(3192): Called: 4
06-11 21:50:10.086: E/newView(3192): Called: 5
06-11 21:50:10.086: E/bindView(3192): Called: 5
06-11 21:50:10.093: E/newView(3192): Called: 6
06-11 21:50:10.093: E/bindView(3192): Called: 6
06-11 21:50:10.093: E/newView(3192): Called: 7
06-11 21:50:10.093: E/bindView(3192): Called: 7
06-11 21:50:10.101: E/newView(3192): Called: 8
06-11 21:50:10.101: E/bindView(3192): Called: 8
06-11 21:50:10.101: E/newView(3192): Called: 9
06-11 21:50:10.101: E/bindView(3192): Called: 9
06-11 21:50:10.125: E/newView(3192): Called: 10
06-11 21:50:10.125: E/bindView(3192): Called: 10
06-11 21:50:10.133: E/newView(3192): Called: 11
06-11 21:50:10.133: E/bindView(3192): Called: 11
06-11 21:50:10.140: D/dalvikvm(3192): GC_CONCURRENT freed 351K, 3% free 15001K/15431K, paused 1ms+2ms
06-11 21:50:10.140: E/newView(3192): Called: 12
06-11 21:50:10.140: E/bindView(3192): Called: 12
06-11 21:50:10.164: E/newView(3192): Called: 13
06-11 21:50:10.164: E/bindView(3192): Called: 13
06-11 21:50:10.179: E/newView(3192): Called: 14
06-11 21:50:10.179: E/bindView(3192): Called: 14
06-11 21:50:10.187: E/newView(3192): Called: 15
06-11 21:50:10.187: E/bindView(3192): Called: 15
06-11 21:50:10.195: E/newView(3192): Called: 16
06-11 21:50:10.195: E/bindView(3192): Called: 16
06-11 21:50:10.203: E/newView(3192): Called: 17
06-11 21:50:10.203: E/bindView(3192): Called: 17
06-11 21:50:10.211: E/newView(3192): Called: 18
06-11 21:50:10.211: E/bindView(3192): Called: 18
06-11 21:50:10.218: E/newView(3192): Called: 19
06-11 21:50:10.218: E/bindView(3192): Called: 19
06-11 21:50:10.218: E/newView(3192): Called: 20
06-11 21:50:10.218: E/bindView(3192): Called: 20
06-11 21:50:10.218: E/newView(3192): Called: 21
06-11 21:50:10.218: E/bindView(3192): Called: 21
06-11 21:50:10.226: E/newView(3192): Called: 22
06-11 21:50:10.226: E/bindView(3192): Called: 22
06-11 21:50:10.226: E/newView(3192): Called: 23
06-11 21:50:10.226: E/bindView(3192): Called: 23
06-11 21:50:10.234: E/newView(3192): Called: 24
06-11 21:50:10.234: E/bindView(3192): Called: 24
06-11 21:50:10.234: E/newView(3192): Called: 25
06-11 21:50:10.234: E/bindView(3192): Called: 25
06-11 21:50:10.242: E/newView(3192): Called: 26
06-11 21:50:10.242: E/bindView(3192): Called: 26
06-11 21:50:10.242: E/newView(3192): Called: 27
06-11 21:50:10.242: E/bindView(3192): Called: 27
06-11 21:50:10.250: D/dalvikvm(3192): GC_CONCURRENT freed 247K, 2% free 15582K/15879K, paused 1ms+1ms
06-11 21:50:10.250: E/newView(3192): Called: 28
06-11 21:50:10.250: E/bindView(3192): Called: 28
06-11 21:50:10.265: E/newView(3192): Called: 29
06-11 21:50:10.265: E/bindView(3192): Called: 29
06-11 21:50:10.265: E/newView(3192): Called: 30
06-11 21:50:10.265: E/bindView(3192): Called: 30
06-11 21:50:10.273: E/newView(3192): Called: 31
06-11 21:50:10.273: E/bindView(3192): Called: 31
06-11 21:50:10.273: E/newView(3192): Called: 32
06-11 21:50:10.273: E/bindView(3192): Called: 32
06-11 21:50:10.281: E/newView(3192): Called: 33
06-11 21:50:10.281: E/bindView(3192): Called: 33
06-11 21:50:10.281: E/newView(3192): Called: 34
06-11 21:50:10.281: E/bindView(3192): Called: 34
06-11 21:50:10.289: E/newView(3192): Called: 35
06-11 21:50:10.289: E/bindView(3192): Called: 35
06-11 21:50:10.289: E/newView(3192): Called: 36
06-11 21:50:10.289: E/bindView(3192): Called: 36
06-11 21:50:10.297: E/newView(3192): Called: 37
06-11 21:50:10.297: E/bindView(3192): Called: 37
06-11 21:50:10.297: E/newView(3192): Called: 38
06-11 21:50:10.297: E/bindView(3192): Called: 38
06-11 21:50:10.297: E/newView(3192): Called: 39
06-11 21:50:10.297: E/bindView(3192): Called: 39
06-11 21:50:10.304: E/newView(3192): Called: 40
06-11 21:50:10.304: E/bindView(3192): Called: 40
06-11 21:50:10.304: E/newView(3192): Called: 41
06-11 21:50:10.304: E/bindView(3192): Called: 41
06-11 21:50:10.312: E/newView(3192): Called: 42
06-11 21:50:10.312: E/bindView(3192): Called: 42
06-11 21:50:10.312: E/newView(3192): Called: 43
06-11 21:50:10.312: E/bindView(3192): Called: 43
06-11 21:50:10.320: E/newView(3192): Called: 44
06-11 21:50:10.320: E/bindView(3192): Called: 44
06-11 21:50:10.336: E/newView(3192): Called: 45
06-11 21:50:10.336: E/bindView(3192): Called: 45
06-11 21:50:10.343: E/newView(3192): Called: 46
06-11 21:50:10.343: E/bindView(3192): Called: 46
06-11 21:50:10.351: D/dalvikvm(3192): GC_CONCURRENT freed 301K, 3% free 16297K/16647K, paused 1ms+3ms
06-11 21:50:10.351: E/newView(3192): Called: 47
06-11 21:50:10.351: E/bindView(3192): Called: 47
06-11 21:50:10.351: E/newView(3192): Called: 48
06-11 21:50:10.359: E/bindView(3192): Called: 48
06-11 21:50:10.367: E/newView(3192): Called: 49
06-11 21:50:10.367: E/bindView(3192): Called: 49
06-11 21:50:10.383: E/newView(3192): Called: 50
06-11 21:50:10.383: E/bindView(3192): Called: 50
06-11 21:50:10.390: E/newView(3192): Called: 51
06-11 21:50:10.390: E/bindView(3192): Called: 51
06-11 21:50:10.406: E/newView(3192): Called: 52
06-11 21:50:10.406: E/bindView(3192): Called: 52
06-11 21:50:10.414: E/newView(3192): Called: 53
06-11 21:50:10.414: E/bindView(3192): Called: 53
06-11 21:50:10.422: E/newView(3192): Called: 54
06-11 21:50:10.422: E/bindView(3192): Called: 54
06-11 21:50:10.422: E/newView(3192): Called: 55
06-11 21:50:10.422: E/bindView(3192): Called: 55
06-11 21:50:10.429: E/newView(3192): Called: 56
06-11 21:50:10.429: E/bindView(3192): Called: 56
06-11 21:50:10.437: E/newView(3192): Called: 57
06-11 21:50:10.437: E/bindView(3192): Called: 57
06-11 21:50:10.453: E/newView(3192): Called: 58
06-11 21:50:10.453: E/bindView(3192): Called: 58
06-11 21:50:10.461: E/newView(3192): Called: 59
06-11 21:50:10.461: E/bindView(3192): Called: 59
06-11 21:50:10.468: E/newView(3192): Called: 60
06-11 21:50:10.468: E/bindView(3192): Called: 60
06-11 21:50:10.484: E/newView(3192): Called: 61
06-11 21:50:10.484: E/bindView(3192): Called: 61
06-11 21:50:10.492: E/newView(3192): Called: 62
06-11 21:50:10.492: E/bindView(3192): Called: 62
06-11 21:50:10.508: E/newView(3192): Called: 63
06-11 21:50:10.508: E/bindView(3192): Called: 63
06-11 21:50:10.515: E/newView(3192): Called: 64
06-11 21:50:10.515: E/bindView(3192): Called: 64
06-11 21:50:10.523: E/newView(3192): Called: 65
06-11 21:50:10.523: E/bindView(3192): Called: 65
06-11 21:50:10.539: E/newView(3192): Called: 0
06-11 21:50:10.539: E/bindView(3192): Called: 0
06-11 21:50:10.547: E/bindView(3192): Called: 0
06-11 21:50:10.547: E/bindView(3192): Called: 0
06-11 21:50:10.578: E/bindView(3192): Called: 0
06-11 21:50:10.593: D/dalvikvm(3192): GC_CONCURRENT freed 392K, 3% free 17115K/17543K, paused 2ms+7ms
06-11 21:50:10.601: E/bindView(3192): Called: 0
06-11 21:50:10.609: E/bindView(3192): Called: 0
06-11 21:50:10.625: E/bindView(3192): Called: 0
06-11 21:50:10.633: E/bindView(3192): Called: 0
06-11 21:50:14.586: D/dalvikvm(3192): GC_FOR_ALLOC freed 307K, 4% free 18033K/18695K, paused 14ms
06-11 21:50:14.632: D/dalvikvm(3192): GC_FOR_ALLOC freed 2K, 3% free 19439K/19911K, paused 11ms
06-11 21:50:14.632: E/bindView(3192): Called: 66
06-11 21:50:14.640: E/bindView(3192): Called: 67
06-11 21:50:14.640: E/bindView(3192): Called: 68
06-11 21:50:14.648: E/bindView(3192): Called: 69
06-11 21:50:14.648: E/bindView(3192): Called: 70
06-11 21:50:14.656: E/bindView(3192): Called: 71
06-11 21:50:14.656: E/bindView(3192): Called: 72
06-11 21:50:14.664: E/bindView(3192): Called: 73
06-11 21:50:14.664: E/bindView(3192): Called: 74
06-11 21:50:14.672: E/bindView(3192): Called: 75
06-11 21:50:14.672: E/bindView(3192): Called: 76
06-11 21:50:14.679: E/bindView(3192): Called: 77
06-11 21:50:14.679: E/bindView(3192): Called: 78
06-11 21:50:14.687: E/newView(3192): Called: 79
06-11 21:50:14.687: E/bindView(3192): Called: 79
06-11 21:50:14.687: E/newView(3192): Called: 80
06-11 21:50:14.687: E/bindView(3192): Called: 80
06-11 21:50:14.687: E/newView(3192): Called: 81
06-11 21:50:14.687: E/bindView(3192): Called: 81
06-11 21:50:14.695: E/newView(3192): Called: 82
06-11 21:50:14.695: E/bindView(3192): Called: 82
06-11 21:50:14.695: E/newView(3192): Called: 83
06-11 21:50:14.695: E/bindView(3192): Called: 83
06-11 21:50:14.750: E/bindView(3192): Called: 84
06-11 21:50:14.750: E/bindView(3192): Called: 85
06-11 21:50:14.757: E/bindView(3192): Called: 86
06-11 21:50:14.757: E/bindView(3192): Called: 87
06-11 21:50:14.765: E/bindView(3192): Called: 88
06-11 21:50:14.765: E/bindView(3192): Called: 89
06-11 21:50:14.812: E/bindView(3192): Called: 90
06-11 21:50:14.820: E/bindView(3192): Called: 91
06-11 21:50:14.820: E/bindView(3192): Called: 92
06-11 21:50:14.828: E/bindView(3192): Called: 93
06-11 21:50:14.828: E/bindView(3192): Called: 94
06-11 21:50:14.828: E/bindView(3192): Called: 95
06-11 21:50:14.851: D/dalvikvm(3192): GC_CONCURRENT freed 1350K, 7% free 20078K/21511K, paused 2ms+3ms
06-11 21:50:14.882: E/bindView(3192): Called: 96
06-11 21:50:14.890: E/bindView(3192): Called: 97
06-11 21:50:14.890: E/bindView(3192): Called: 98
06-11 21:50:14.890: E/bindView(3192): Called: 99
06-11 21:50:14.898: E/bindView(3192): Called: 100
06-11 21:50:14.898: E/bindView(3192): Called: 101
06-11 21:50:14.945: E/bindView(3192): Called: 102
06-11 21:50:14.945: E/bindView(3192): Called: 103
06-11 21:50:14.953: E/bindView(3192): Called: 104
06-11 21:50:14.953: E/bindView(3192): Called: 105
06-11 21:50:14.961: E/bindView(3192): Called: 106
06-11 21:50:14.961: E/bindView(3192): Called: 107
06-11 21:50:15.078: E/bindView(3192): Called: 108
06-11 21:50:15.086: E/bindView(3192): Called: 109
06-11 21:50:15.086: E/bindView(3192): Called: 110
06-11 21:50:15.093: E/bindView(3192): Called: 111
06-11 21:50:15.093: E/bindView(3192): Called: 112
06-11 21:50:15.101: E/bindView(3192): Called: 113
06-11 21:50:15.711: E/bindView(3192): Called: 114
06-11 21:50:15.718: E/bindView(3192): Called: 115
06-11 21:50:15.718: E/bindView(3192): Called: 116
06-11 21:50:15.726: E/bindView(3192): Called: 117
06-11 21:50:15.726: E/bindView(3192): Called: 118
06-11 21:50:15.734: E/bindView(3192): Called: 119
06-11 21:50:15.734: E/bindView(3192): Called: 120
06-11 21:50:15.742: E/bindView(3192): Called: 121
06-11 21:50:15.742: E/bindView(3192): Called: 122
06-11 21:50:15.750: E/bindView(3192): Called: 123
06-11 21:50:15.750: E/bindView(3192): Called: 124
06-11 21:50:15.757: E/bindView(3192): Called: 125
06-11 21:50:15.867: E/bindView(3192): Called: 126
06-11 21:50:15.867: E/bindView(3192): Called: 127
06-11 21:50:15.875: E/bindView(3192): Called: 128
06-11 21:50:15.875: E/bindView(3192): Called: 129
06-11 21:50:15.882: E/bindView(3192): Called: 130
06-11 21:50:15.882: E/bindView(3192): Called: 131
06-11 21:50:15.922: E/bindView(3192): Called: 132
06-11 21:50:15.929: E/bindView(3192): Called: 133
06-11 21:50:15.929: E/bindView(3192): Called: 134
06-11 21:50:15.953: E/bindView(3192): Called: 135
06-11 21:50:15.961: E/bindView(3192): Called: 136
06-11 21:50:15.961: E/bindView(3192): Called: 137
06-11 21:50:15.968: D/dalvikvm(3192): GC_CONCURRENT freed 2012K, 10% free 20197K/22215K, paused 2ms+3ms
06-11 21:50:15.968: E/bindView(3192): Called: 138
06-11 21:50:15.976: E/bindView(3192): Called: 139
06-11 21:50:15.984: E/bindView(3192): Called: 140
06-11 21:50:15.984: E/bindView(3192): Called: 141
06-11 21:50:15.992: E/bindView(3192): Called: 142
06-11 21:50:15.992: E/bindView(3192): Called: 143
06-11 21:50:16.039: E/bindView(3192): Called: 144
06-11 21:50:16.039: E/bindView(3192): Called: 145
06-11 21:50:16.047: E/bindView(3192): Called: 146
06-11 21:50:16.047: E/bindView(3192): Called: 147
06-11 21:50:16.054: E/bindView(3192): Called: 148
06-11 21:50:16.054: E/bindView(3192): Called: 149
06-11 21:50:16.062: E/bindView(3192): Called: 150
06-11 21:50:16.062: E/bindView(3192): Called: 151
06-11 21:50:16.062: E/bindView(3192): Called: 152
06-11 21:50:16.070: E/bindView(3192): Called: 153
06-11 21:50:16.070: E/bindView(3192): Called: 154
06-11 21:50:16.070: E/bindView(3192): Called: 155
06-11 21:50:16.117: E/bindView(3192): Called: 156
06-11 21:50:16.117: E/bindView(3192): Called: 157
06-11 21:50:16.125: E/bindView(3192): Called: 158
06-11 21:50:16.125: E/bindView(3192): Called: 159
06-11 21:50:16.125: E/bindView(3192): Called: 160
06-11 21:50:16.132: E/bindView(3192): Called: 161
06-11 21:50:16.172: E/bindView(3192): Called: 162
06-11 21:50:16.172: E/bindView(3192): Called: 163
06-11 21:50:16.179: E/bindView(3192): Called: 164
06-11 21:50:16.179: E/bindView(3192): Called: 165
06-11 21:50:16.187: E/bindView(3192): Called: 166
06-11 21:50:16.187: E/bindView(3192): Called: 167
06-11 21:50:16.328: E/bindView(3192): Called: 168
06-11 21:50:16.336: E/bindView(3192): Called: 169
06-11 21:50:16.336: E/bindView(3192): Called: 170
06-11 21:50:16.343: E/bindView(3192): Called: 171
06-11 21:50:16.343: E/bindView(3192): Called: 172
06-11 21:50:16.351: E/bindView(3192): Called: 173
06-11 21:50:16.461: E/bindView(3192): Called: 174
06-11 21:50:16.468: E/bindView(3192): Called: 175
06-11 21:50:16.492: E/bindView(3192): Called: 176
06-11 21:50:16.492: E/bindView(3192): Called: 177

This seems to show quite clearly that once the views have been created by a call to newView(), bindView() handles converting the views to optimize memory.

(The few lines where newView() is called around the middle are just the GridView requiring a new row when displaying two fractions of a row as opposed to one whole).

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