Tag: favicon

如何知道链接将被重定向

我遇到了这种类型的问题 – 当我尝试下载某些网站的favicon时,您会遇到重定向(例如google.com / favicon.ico – > www.google.com / favicon.ico)。 在这种情况下,我的代码不保存图像。 我想知道是否可以知道页面是否被重定向,或者如何更改我的代码以解决这个障碍。 我希望得到你的帮助。 @Override protected Boolean doInBackground(Void…param) { Log.d(“url in NetworkTask”, url); HttpGet httpGet = new HttpGet(url); AndroidHttpClient httpClient = AndroidHttpClient .newInstance(“Android”); HttpResponse httpResponse = null; try { httpResponse = httpClient.execute(httpGet); } catch (IOException e) { e.printStackTrace(); } if(httpResponse!=null) primaryCodeStatus = httpResponse.getStatusLine() .getStatusCode(); else Log.d(“httpResponse”, […]