Did you know that the Android SDK makes it relatively easy to load code and resources from other apks into your own application? One way is to use a PathClassLoader and point it to an arbitrary APK:
Another way is to use createPackageContext and use that context’s
ClassLoader to instantiate objects and load referenced resources.
Let’s suppose we want to use the standard messaging application’s (Mms.apk)
SmileyParser class that annotates CharSequences with spans to convert textual emoticons to graphical ones. Even though this functionality is not exposed, we can write a wrapper like the following to use it:
Now we can use our wrapper to annotate arbitrary text with graphical emoticons:
And here is the result:
Reaching past the SDK is obviously a very bad idea but there are a lot of useful things (e.g. SMS API) in the Android code base that are (not yet) public and I think it is okay to use the aforementioned methods for personal (experimental) applications.