我有這樣一個問題:這爲什麼有效? (sameAs的VS ==)
Why is this not working sometimes?
我比較的位圖和相應的執行代碼,但是代碼是不執行。我的問題收到了很多好的答案。其中一個有效的答案建議刪除==
,並將其更改爲.sameAs()
,以使我的應用可以在較新的手機上工作。
ClickGround = v.getBackground(); //Get the background of button clicked (ClickGround is a bitmap)
BitClick = ((BitmapDrawable) ClickGround).getBitmap(); //the bitmap background of the button clicked
那麼,爲什麼更有效地使用sameAs()
工作方法比使用==
比較位圖?此外,爲什麼使用==
工作在更低版本的android(kitkat)和sameAs
更高版本?
感謝,
Ruchir
如果你在鏈接問題中注意到,你會看到第一個答案陳述了一些關於「我比較不同的對象」的內容。爲什麼? –