activity getting started twice android code example
Example: android java how to stop activity from opening twice programatically
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);