I'm reworking some code to make it usable with the new RootTools 3.0 (which fixes an important bug):
One section I rewrote looks like this, with a callback-class for better readability. I'm adding the size of two directories to tell the total of browser cache that may be cleared:
@Override
protected void onResume() {
super.onResume();
//Refresh views:
try {
//Show browser's cache size:
ShellCommands.getListing("/data/data/com.android.browser/app_databases/", null, new Callback<SumSize>() {
@Override
public void call(SumSize localstore) throws InterruptedException, IOException, TimeoutException, RootDeniedException {
final SumSize total = localstore;
getFirefoxProfiles(new Callback<String>() {
@Override
public void call(String input) throws InterruptedException, IOException, TimeoutException, RootDeniedException {
ShellCommands.getListing(input+"/Cache/", null, new Callback<SumSize>() {
@Override
public void call(SumSize input) {
total.add(input);
((TextView)findViewById(R.id.lblClearBrowser)).setText(total.getReadable());
}
});
}
});
}
});
A bit more complex than it was with the .waitforfinish
, but I'm having a serious problem in debugging: the inner most call(SumSize input) seems to work correctly, but there is no way to see what the total is when debugging. Is this a bug in Java with final
outer variables? A bug in Android? A bug in Eclipse?