Android: Bugfixes

* Partial work on #315
* Fixes for #340 and #366