What is the best way of generating (in code) a letter avatar like in Gmail?
Here you have an example
https://drive.google.com/folderview?id=0B0Fhz5fDg1njSmpUakhhZllEWHM&
If you are asking only about avatar on the left in that ListView.
Use ImageView, and if you have user avatar - put it there, if you don't have avatar - use .drawText("R") function to draw canvas and put it in ImageView using setImageDrawable.