Determine If Current View is a Specific Activity
I am wanting to set an intent on a logo in the titleBar of my application to go back to the main entry screen when clicked unless of course we are already at that screen. How do I go开发者_开发百科 about checking this in an if statement?
Unless I don't understand you correctly, you should just be able to check the class:
if(getClass() == MainActivity.class){
}
Try that and see if it works.
精彩评论