I have an external .hash file which I tired reading as a simple remote text file:
private class getHash extends AsyncTask<String, Void, String>{
@Override
protected String doInBackground(String... params) {
String str = null;
try {
// Create a URL for the desired page
URL url = new URL(params[0]);
// Read all the text returned by the server
InputStream is = url.openStream();//The line it crashes on
InputStreamReader isr = new InputStreamReader(is);
BufferedReader in = new BufferedReader(isr);
str = in.readLine();
in.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
@Override
protected void onPostExecute(String result) {
hash = result;
}
}
Then I call the thread :
getHash hashThread = new getHash();
hashThread.execute(new String[]{"http://www......................hash"});
During execution of the noted line in the class all stops are pulled and I get slapped by the classy Source not found
crash.
LogCat gives this error:
W/dalvikvm(724): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
Are you running this in debug mode or regular mode? The source not found
message would seem to indicate you are trying to step into code that has no source attached for it.
Also have you added <uses-permission android:name="android.permission.INTERNET" />
to your AndroidManifest.xml
?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.