Xamarin FindViewById returns null

后端 未结 3 634
有刺的猬
有刺的猬 2020-12-20 15:38

Hi guys I need a little advice. I trying to made an android app using Xamarin so C#. I made two layouts and in each one of them I made tow buttons to navigate between them.I

3条回答
  •  太阳男子
    2020-12-20 16:36

    You are setting Main as the layout for your activity and then in the following lines of code you are asking to find a button named Back at runtime which is not part of this layout. This means the following line will return null:

    FindViewById

    Now if you do FindViewById

提交回复
热议问题