Java tutorial
//package com.java2s; import java.io.File; import android.content.Context; public class Main { private static Context sCurrentContext; /** * <pre> * Get absolute path in app 's cache folder from relative path. * </pre> */ public static String getCacheAsbPath(String relativePath) { File cacheDir = getCurrentContext().getCacheDir(); return cacheDir.getAbsolutePath().concat("/").concat(relativePath); } /** * <pre> * Get current context of the app. This method resolves the inconvenience of Android which requires context for most of its API. * If no activity is resumed, this method returns application context. Otherwise, this method returns last resumed activity. * </pre> */ public static Context getCurrentContext() { return sCurrentContext; } }