I have a custom View that runs a Thread operation which sits around making calls to the interwebs periodically. I would like to know if there\'s a way for me to not have to kil
if Build.VERSION.SDK_INT < Build.VERSION_CODES.N
@Override
protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (visibility == View.VISIBLE) //onResume called
else // onPause() called
}
then Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
@Override
public void onVisibilityAggregated(boolean isVisible) {
super.onVisibilityAggregated(isVisible);
if (isVisible) //onresume() called
else // onPause() called
}
you can read source code of ProgressBar to get idea.