Merge "Give a reflection example for installing the HTTP response cache."
diff --git a/core/java/android/net/http/HttpResponseCache.java b/core/java/android/net/http/HttpResponseCache.java
index 5f65dfa..21736aa 100644
--- a/core/java/android/net/http/HttpResponseCache.java
+++ b/core/java/android/net/http/HttpResponseCache.java
@@ -136,6 +136,18 @@
* int maxStale = 60 * 60 * 24 * 28; // tolerate 4-weeks stale
* connection.addRequestProperty("Cache-Control", "max-stale=" + maxStale);
* }</pre>
+ *
+ * <h3>Working With Earlier Releases</h3>
+ * This class was added in Android 4.0 (Ice Cream Sandwich). Use reflection to
+ * enable the response cache without impacting earlier releases: <pre> {@code
+ * try {
+ * File httpCacheDir = new File(context.getCacheDir(), "http");
+ * long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
+ * Class.forName("android.net.http.HttpResponseCache")
+ * .getMethod("install", File.class, long.class)
+ * .invoke(null, httpCacheDir, httpCacheSize);
+ * } catch (Exception httpResponseCacheNotAvailable) {
+ * }}</pre>
*/
public final class HttpResponseCache extends ResponseCache implements Closeable {