I'm under Android Studio, and I'm trying to debug my app.
So I put 4 breakpoints in different places (see my code below), number 1 and 4 are called but not 2 and 3. It's been a day I search why but I have no clue. (It actually happens to a lot of other breakpoints).
I tried to delete the line at breakpoint 3 (which call later breakpoint 4) to see if it was actually called, and yes if I delete it nothing happens (breakpoint 4 is never called). Does anybody knows why ? Am I missing something ?
Here is my code :
AuthenticationActivity.java
checkAccount(){
tokenGetter = new TokenGetter();
tokenGetter.setParameter(accountManagerFuture, accounts[0]);
tokenGetter.execute(); //BREAKPOINT 1
}
private class TokenGetter extends AsyncTask{
AccountManagerFuture<Bundle> accountManagerFuture;
Account account;
public void setParameter(AccountManagerFuture<Bundle> accountManagerFuture, Account account) {
this.accountManagerFuture = accountManagerFuture;
this.account = account;
}
@Override
protected Object doInBackground(Object[] objects) {
Bundle b = null;
try {
b = accountManagerFuture.getResult(2000, TimeUnit.MILLISECONDS); //BREAKPOINT 2
} catch (Exception e) {
//e.printStackTrace();
}
return b;
}
@Override
protected void onPostExecute(Object b) {
if(b != null)
{
TOKEN = ((Bundle)b).get(AccountManager.KEY_AUTHTOKEN).toString();
accountManager.setAuthToken(account, accountType,TOKEN);
}
profileDataFactory = new ProfileDataFactory();
profileDataFactory.setParameters(getApplicationContext(), "users/me", ReceiveDataService.PROFILE); //BREAKPOINT 3
}
}
ReceiveDataService.java
int responseCode = urlConnection.getResponseCode(); //BREAKPOINT 4
if (responseCode != 200) {
if(responseCode == 401) {
throw new Exception(TOKEN_EXPIRED);
} else {
if (BuildConfig.DEBUG) Log.e(TAG,"Status Error CODE : " + responseCode);
throw new Exception(REQUEST_FAILED);
}
}