It gets hot because it's using more power - at a guess your code is sitting in a loop somewhere being "busy" all the time instead of waiting and letting the system slow things down when there isn't much going on.
But without your full code - and I'm not going to wade through it all - we can;t really help you.
Have a look at some of these:
Google: "Android profiling"[
^] - they may help you find out where your app is "busy".