I’ve read quite a lot on forums, and from that it seems that contacts and their phone numbers are stored on separate databases on android.
Could someone explain how data from these databases are linked to the ContactsContract.RawContact class, and how it is organized in ContactsContract.Contacts and ContactsContract.CommonDataKinds ? Also what is the difference between these two classes, when they represent a lot of similar information of a contact.
The ContactsContract is one database. But you can query different tables. And some of the tables have other info added to them through joins. So if you query the ContactsContract.Data table, you can access the ContactsContract.RawContacts and ContactsContract.Contacts tables.
Go digging through the links and you will find a lot of info. Basically you have a Contact that is made up of RawContacts that have Data.