I am trying to create a simple source code reader that reads and displays the source-code of a web page using a URL entered in an EditText view, but can't initialise the InputSteramReader and the BufferedReader correctly. Testing this following code on Android 4.4.2, LogCat shows this error :
-->> SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
URL url = null;
url = new URL(et.getText().toString());
URLConnection conn = url.openConnection();
InputStreamReader isr = new InputStreamReader(conn.getInputStream());
BufferedReader br = new BufferedReader(isr);
The connection is created successfully, but the last two lines cause error.I have set the permission to access internet in manifest file, used different input types for the edit-text view and tried defining buffer size, but that doesn't work either. Please help in identifying any mistakes in this code.