URL test = null;
String inputLine = null;
BufferedReader in = null;
try {
test = new URL("http://localhost/out.php"); // if connection down
} catch (MalformedURLException e) {
inputLine = "test_synntax";
}
try {
in = new BufferedReader(new InputStreamReader(test.openStream()));
...
How assign an value for inputline if by default the URL resolution has failed
In example context not wifi/3g connection disponible, thanks guys good day
You would need to call
URL.openConnectionfirst and then place your default value in theIOExceptionblock: