//universal imageloader获取图片时,若需要cookie,需在application中进行配置添加此类。
importandroid.content.Context; import com.nostra13.universalimageloader.core.download.BaseImageDownloader; import java.io.IOException; import java.net.HttpURLConnection; /** * */ public class CustomImageDownloader extends BaseImageDownloader {//universal image loader获取图片时,若需要cookie, // 需在application中进行配置添加此类。 public CustomImageDownloader(Context context) { super(context); } @Override protected HttpURLConnection createConnection(String url, Object extra) throws IOException { // Super... HttpURLConnection connection = super.createConnection(url, extra); // connection.setRequestProperty("Cookie", MyApplication.getInstance().getCookieString()); connection.setRequestProperty("Connection", "keep-Alive"); connection.setRequestProperty("User-Agent", "jsgdMobile"); return connection; } }