Here is the code that causes the problem:
which is part of another class.
I dont see any errors in Eclipse but when I load the library in B4A I get:
Since it is a static class why do I need to instantiate it?
Maybe it has something to do with AsyncTask?
Thanks in advance!
B4X:
@ShortName("DownloadFileTask")
public static class DownloadFileTask extends AsyncTask<String, Integer, Boolean>
{
@Override
protected Boolean doInBackground(String... arg0) {
String root = arg0[0];
String dbPath = arg0[1];
String localFile = arg0[2];
String etag = arg0[3];
BufferedInputStream br = null;
BufferedOutputStream bw = null;
HttpEntity entity = null;
String result = "";
try {
FileDownload response = getFileStream(root, dbPath, etag);
try {
br = new BufferedInputStream(response.is);
bw = new BufferedOutputStream(new FileOutputStream(localFile));
byte[] buffer = new byte[4096];
int read;
while (true) {
read = br.read(buffer);
if (read <= 0) {
break;
}
bw.write(buffer, 0, read);
}
} finally {
System.out.println("Result: " + result);
if (bw != null) {bw.close();}
if (br != null) {br.close();}
}
} catch (SocketException se) {
System.out.println(se.toString());
Log.w("B4A","Socket Exception");
} catch (IOException ioe) {
System.out.println(ioe.toString());
Log.w("B4A","IO Exception");
} finally {
System.out.println("Result: " + result);
}
return true;
}
}
which is part of another class.
I dont see any errors in Eclipse but when I load the library in B4A I get:
object reference not set to an instance of an object
Since it is a static class why do I need to instantiate it?
Maybe it has something to do with AsyncTask?
Thanks in advance!