* improved pluginPreferenceActivity (yes, I tested it in tablet mode)

* made IITC_FileManager.readStream(...) static and always use it when reading src files
This commit is contained in:
Philipp Schaefer
2014-01-22 10:45:20 +01:00
parent a161c4e181
commit d8a09bbae2
4 changed files with 98 additions and 99 deletions

View File

@ -2,11 +2,12 @@ package com.cradle.iitc_mobile.async;
import android.os.AsyncTask;
import com.cradle.iitc_mobile.Log;
import com.cradle.iitc_mobile.IITC_FileManager;
import java.io.IOException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.URL;
import java.util.Scanner;
/*
* this class parses the content of a web page.
@ -20,10 +21,10 @@ public class UrlContentToString extends AsyncTask<URL, Integer, String> {
String js = "";
URL url = urls[0];
try {
js = new Scanner(url.openStream(), "UTF-8").useDelimiter("\\A")
.next();
} catch (IOException e) {
Log.w(e);
FileInputStream is = new FileInputStream(new File(url.getPath()));
js = IITC_FileManager.readStream(is);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return js;
}