I'm developing a music player app using Android Studio, the app works fine. But I've noticed that the phone on which I'm testing the app is getting hot (in the baack), not so much but perceptible, when the app's running.
So I run the monitor there is a load on the CPU graph, even though no song is playing. This seems to happen only when the app is opened, not when songs are played in the background.
And I've noticed RAM allocation also is weird.
Please any advice. Thanks.
EDIT: I think this may have causing the issue:
private void updatePosition(final MenuItem menuItem) {
runnable = null;
switch (menuItem.getItemId()) {
case R.id.nav_online:
mDrawerLayout.closeDrawers();
Handler handler1 = new Handler();
handler1.postDelayed(new Runnable(){
@Override
public void run(){
InDeveloppement.showDialog(MainActivity.this);
}
}, 300);
break;
case R.id.nav_edit_metadata:
mDrawerLayout.closeDrawers();
Handler handler2 = new Handler();
handler2.postDelayed(new Runnable() {
@Override
public void run() {
InDeveloppement.showDialog(MainActivity.this);
}
}, 300);
break;
}
}
Is that a bad method of showing dialog this way?