Android debug tips

Print stack trace:

By adding the following piece of code to your function, you can see the call stack for the give function. This may help you in understanding program flow. 

try {
            IOException e = new IOException();
            throw e;
        } catch (IOException e) {
            e.printStackTrace();
        }