Parent activity type for NativeActivity activities

馋奶兔 提交于 2019-12-23 14:58:28

问题


Is there any way in which it can be seen the type of the parent activity of a NativeActivity from the Execute method ?


回答1:


Yes, you can execute the following code block and it will return you the value of the internal Parent property -- this will be the instance of your parent.

this.GetType()
    .GetProperty(
        "Parent", 
        System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
    .GetValue(this, null)


来源:https://stackoverflow.com/questions/5882680/parent-activity-type-for-nativeactivity-activities

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!