Reputation: 18130
I'm still new to programming/Java/Android so I'm trying to understand everything I do and trying to figure out how to properly read the reference section of developer.android.com and so maybe one of you guys can help me out. Thanks in advance
These calls get me the ANDROID_ID. They both give me the same output. I just do not understand how the Second Way works. It shouldn't work in my opinion.
AndroidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
AndroidID = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
Why does it work like that?
I used this to find the getString() method. I get the ANDROID_ID. It works perfectly using both calls, but I want to know why it works the second way.
Upvotes: 1
Views: 1669
Reputation: 10883
I'm pretty sure the reason is because you have:
import android.provider.Settings.Secure;
In your imports. Similarly you'll find that both DialogInterface and View have different implementations of classes called OnClickListener, but you can still do something like:
// View.OnClickLitener
OnClickListener foo = new OnClickListener(...) {
...
}
DialogInterface.OnClickListener bar = new DialogInterface.OnClickListener(...) {
...
}
Upvotes: 2