Seems like a job for either the listings
or the minted
packages; both are customizable and offer Java as one of the predefined languages.
Using listings
you can define your own set of rules for syntax highlighting for Android (see Sections 3.2 and 4.18 Language definitions of the package documentation)); Android is not one of the predefined languages in minted either, so you will also have to define a new language.
Additionally, with each one of the packages you can easily produce a list of your listings using \lstlistoflistings
(with listings
) or \listoflistings
(with minted
), and you can input your code from external files using \lstinputlisting
(with listings
) or \inputminted
(with minted
).
Since minted
uses Pygments
, it provides far superior syntax highlighting compared to listings
; on the other hand, listings
offers automatic breaking of long lines and, as far as I know, this feature is not offered by minted
.