Created
October 21, 2011 15:30
-
-
Save akfish/1304125 to your computer and use it in GitHub Desktop.
A minor change on Android API Level 2.3.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection(); | |
String sHeader = httpConnection.getHeaderFieldKey(i); | |
if (sHeader.equals("content-length")) { | |
//Unpredictable | |
//Under the same server setup, the API level before 2.3.3 will return true. | |
//But not this one | |
} | |
if (sHeader.equalsIgnoreCase("content-length")) { | |
//True | |
//It seems that in 2.3.3, all header field key are case sensitive. | |
} | |
//Summary: Always use equalsIgnoreCase, if letter case is not needed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment