Question

I have worked a lot with the Android Compatibility library and have always used the class in the library over the class in the Android jar to ensure backwards compatibility.

Is this the correct way to use it?

I had an idea to have an interface for the classes that use the library. This way I can build 2 classes from that type. 1 that uses the ACL and the other uses the Android jar. Using roboguice I can automatically use the correct type.

Would there be any advantage or disadvantages of doing it this way?

Was it helpful?

Solution

The biggest disadvantage would be that there could be slight implementation changes when using the actual android jar vs the compatibility library. This is why the compatibility library does not switch implementation when running on 3.0 and above, even though it could.

To keep everything consistent and avoid headaches, keep the support library implementation globally unless you are implementing something specific to one api version.

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