舉個(gè)例子:Private Button btn;btn =?(Button)findViewById(R.id.btn);?btn.setOnClickListener(this);--------------------------------------可是個(gè)人比較習(xí)慣用以下的形式:findViewById(R.id.btn).setOnClickListener(this);---------------------------------------關(guān)于上述的兩種形式,會(huì)不會(huì)因?yàn)槲业牧?xí)慣是沒有用一個(gè)引用來(lái)指向Button的對(duì)象,導(dǎo)致在gc執(zhí)行時(shí)被清理到,最終導(dǎo)致一些奇奇怪怪的問題??????
- 3 回答
- 0 關(guān)注
- 1429 瀏覽
添加回答
舉報(bào)
0/150
提交
取消