[iitcm] bugfix (NPE on some devices)
This commit is contained in:
parent
387a9ab3da
commit
f8563e4fe4
@ -15,6 +15,7 @@ import com.cradle.iitc_mobile.share.ShareActivity;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.NullPointerException;
|
||||||
|
|
||||||
// provide communication between IITC script and android app
|
// provide communication between IITC script and android app
|
||||||
public class IITC_JSInterface {
|
public class IITC_JSInterface {
|
||||||
@ -205,6 +206,7 @@ public class IITC_JSInterface {
|
|||||||
mIitc.runOnUiThread(new Runnable() {
|
mIitc.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
try {
|
||||||
if (progress != -1) {
|
if (progress != -1) {
|
||||||
// maximum for setProgress is 10,000
|
// maximum for setProgress is 10,000
|
||||||
mIitc.setProgressBarIndeterminate(false);
|
mIitc.setProgressBarIndeterminate(false);
|
||||||
@ -214,6 +216,11 @@ public class IITC_JSInterface {
|
|||||||
mIitc.setProgressBarIndeterminate(true);
|
mIitc.setProgressBarIndeterminate(true);
|
||||||
mIitc.setProgress(1);
|
mIitc.setProgress(1);
|
||||||
}
|
}
|
||||||
|
} catch(NullPointerException e) {
|
||||||
|
// for some reason, setProgressBarIndeterminate throws a NullPointerException on some devices
|
||||||
|
e.printStackTrace();
|
||||||
|
mIitc.setProgress(10000); // hide the progress bar
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user