Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I redirect URL to file location on 4.0.3?

For example, browser want to connect to but it redirected to file:///sdcard/

It can't work through hosts, because it used for domains only, some people tell me about local proxy, but how?

share|improve this question
Via the hosts file you could redirect certain requests to a web server running locally on the device (you'd need to find and install one) which could potentially serve some form of index pages for folders on the device. You can't do much else if the browser doesn't support file:// URIs. The question I have is: Why do you want to do this? Using the browser for accessing files is going to be worse in most every way compared to an actual file explorer. – Matthew Read Mar 26 '12 at 20:24
I want to do offline android documentation acces for Android IDE – mishkapp Mar 26 '12 at 23:42
Oh, so actual HTML rather than arbitrary files? Yeah, that should be easy if you install a web server. I would expect you wouldn't need to edit hosts actually -- just use http://localhost/. – Matthew Read Mar 27 '12 at 2:06
okay, i install web server working on but when i write "" i can't connect through URL – mishkapp Mar 27 '12 at 13:10
That ... doesn't make sense. A local server needs to serve local files, if you were trying to access directly you wouldn't need anything local. If you install the Android SDK on your PC, you can grab the docs folder and put it on your device where the webserver can see it (or configure the server to point to wherever it is on the device). The URL you'll end up using depends on that configuration but it would probably be something like http://localhost/docs/index.html. – Matthew Read Mar 27 '12 at 17:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.