Here is some code for the idea of my problem:
@Override
public void onDestroy() {
Log.e("onDestroy------------->", "onDestroy called");
Toast.makeText(this, " onDestroy Started", Toast.LENGTH_LONG).show();
super.onDestroy();
}
and
b2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//startServiceManually();
stopService(i);
}
});