Hi ..

we have a anddroid app which is connected to a server url ..som thing like we have used iframe kind of thing

and when ever a user with out internet connection opens it it is showing a a normal 404 page like http://www.soandso.com/app is not available ..

i dont want the url to be displayed and i want to show a custom page just like fb does with a antenna symbol

any help is appreciable

Recommended Answers

All 4 Replies

Open the connection yourself, see if it's a 404, if it is, use your own html, if it's not, display the given html.

it is not eactly 404 ..but where is no connectivity it is showing not found error

I'm not sure about the specifics of the android C API for network connections, but there should be a handler for it somwhere. Try to make a TCP connection, and if it fails, display your error page. Else, continue as normal.

What ever library you use it will have something similar to default Android implementation of HttpResponse.getStatusLine()link from which you get StatusLine and here you can get actual code value. This is often in libraries simplyfied to something like HttpResponse.getStatusCode or similar

So all you have to do is fire your HttpRequest, wait for HttpResponse, then evaluate for what ever error messages you want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.