开发者

Determine If Current View is a Specific Activity

开发者 https://www.devze.com 2023-04-05 19:08 出处:网络
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开发者_开发百科 ab

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号