Sometimes (Facebook) you have a system of many different interacting programs, each of which can be written in a different language, and even be running on different machines. I am sure that a complex website like Facebook involves many pieces written in many different mainstream and homespun "languages".
Other times (Android) you have a single entity in which pieces written in different languages are combined. I'm over simplifying a bit, but if you think about it, compilers ultimately compile down to machine code, and a linker can simply combine the pieces.
In reality, it's often more complex, and many languages are interpreted rather than compiled. To combine languages that have complex runtime systems like Java, Python, Ruby, etc into one program, there will be specific, point-to-point solutions for each case. For example, the Java Native Interface (JNI) is a standard mechanism for embedding Java into C and C++ programs.