开发者

Holder pattern approached differences and performance comparisons

I have seen two ways of doing the same thing, and I do not know what is faster and what is better , and what is the difference . . .

I mean only this few row at the begging are differences and everything else is the same, but still there are two approaches and I do not understand what is different and which way is faster

case one:

public View getView(int position, View conv开发者_如何学编程ertView,ViewGroup parent) {
    View row=super.getView(position, convertView, parent);
    ViewHolder holder=(ViewHolder)row.getTag();

case two:

public View getView(int position, View convertView,ViewGroup parent) {
        //of course some checks if the convertView is null, but that is not the point
    ViewHolder holder=(ViewHolder)convertView.getTag();

one more sub-question :-) How can I test what is faster ? I mean how should I do testing for performance on adapters ?

Thanks


I do not understand what is different and which way is faster

What is different is that the first one is chaining to the superclass, and the second one is not.

How can I test what is faster ? I mean how should I do testing for performance on adapters ?

Use Traceview.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜