Linking android XML to a Java class?

后端 未结 1 1767
星月不相逢
星月不相逢 2021-02-15 01:05

I have \"main_activity.xml\" which is linked to MainActivity.java class, but I wish to link my \"login_activity.xml\" to \"Login.java\" class.

  • How to link each and
相关标签:
1条回答
  • 2021-02-15 01:07
    public class Your_Class_Name extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.Your_XML_FileName);
            ...
        }
    }
    

    This is how you do it.

    0 讨论(0)
提交回复
热议问题