Binding XML Android to Java Class?

I have "main_activity.xml" that is associated with the MainActivity.java class, but I want to associate my "login_activity.xml" with the "Login.java" class.

  • How to associate each XML android with a separate Java class?
+6
source share
1 answer
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.

+8
source

Source: https://habr.com/ru/post/945398/


All Articles