I always admired the way Android Studio operates in some aspects, like the ability to find out every thing that is not ok, like arrays that get declared and written, but never read, or functions that get never called.
The problem now is that I have an async function using along with the Parse SDK (Facebook Login) that seems just not understood by the IDE.
Button mFbParseLoginButton = (Button) findViewById(R.id.fbloginbutton);
final java.util.List<String> permissions = Arrays.asList("user_friends", "user_birthday", "user_hometown", "public_profile");
mFbParseLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ParseFacebookUtils.logInWithReadPermissionsInBackground(LoginActivity.this, permissions, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
if (user == null) {
Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
} else if (user.isNew()) {
Log.d("MyApp", "User signed up and logged in through Facebook!");
// Create the user
regFacebookUser(user);
//registerFacebookUser(user);
} else {
Log.d("MyApp", "User logged in through Facebook!");
loginFacebookUser(user);
}
}
});
}
});
It just seems not to understand that this code potentially can call regFacebookUser
and loginFacebookUser
functions.
These buttons have been working for days of this app's development, and still do and receive the logs
06-03 15:30:54.460 1543-1543/xxxxxxxxxxxxx D/MyApp﹕ User logged in through Facebook!
But this is how actually Android Studio displays the code of regFacebookUser
If you know how Android Studio works, you'll know that when a method or a variable is grey, it means it's never used. Indeed it's the thing it says when I go hover every grey variable of this code. At the right, in the scrollbar there are yellow squares everywhere around all the code for this. What can I do to resolve this bug?
I got Android Studio 0.9.9 and always been working fine. I wouldn't upgrade to the newer 1.2 to avoid incompatibility issues to the projects I'm working on. (When I had Eclipse the only upgrading of SDK messed up everything to me)