How to make Web Source code viewer app in Sketchware
Web source code viewer app in sketchware. First you have to make a app with edittext , button , linear , scollview and a textview for showing results. Then create a more block extra which create a AsyncTask with name BackTask. Then add the following code:- } private class BackTask extends AsyncTask<String, Integer, String> { @Override protected void onPreExecute() {} protected String doInBackground(String... address) { String output = ""; try { java.net.URL url = new java.net.URL(address[0]); java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(url.openStream())); String line; while ((line = in.readLine()) != null) { output += line; } in.close(); } catch (java.net.MalformedURLException e) { output = e.getMessage(); } catch (java.io.IOException e) { output = e.getMessage(); } catch (Exception e) { output = e.toString(); } return output; } protected void onProgressUpdate(Integer... values) {} protected void onPostExecute(String s){ t...

Comments
Post a Comment