I try to download file from the internet with this method:
try {
URL url = new URL("http://sites.google.com/site/androidersite/text.txt");
BufferedReader in =new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLine()) != null) { newline character(s)
}
in.close();
} catch (MalformedURLException e) {
} catch (IOException e) {
}
I also update my Android Manifest and add this lines:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
and the app crash in this line :
BufferedReader in =new BufferedReader(new InputStreamReader(url.openStream()));
and popup a log file that wrote: Source not found