android.support.v4.util.Pair vs android.util.Pair

浪尽此生 提交于 2019-12-10 03:10:08

问题


I read about support.v4 lib that allows android backward compatibility.

So IIUC, when there is an ambiguity - it's always best practice to import the lib from android.support.v4 ...

right?


回答1:


Yeah, it's wise but not always needed.

I this case Pair is API 5 and quite usefull class so it was added to v4library.

Another example are Fragments. If you want to use ViewPager with Fragments most probably you need Fragments from v4 as ViewPager is from v4 as well...



来源:https://stackoverflow.com/questions/32214067/android-support-v4-util-pair-vs-android-util-pair

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!