Can I have a class which extend a LinearLayout, as the main class of the Android project? I’m new to android developing. Is it a must to extend the Activity class when we creating a new project?
If it is possible to have a class which extend the LinearLayout, can anyone tell me how to do it? For example how to add a textView, EditText something like that to the LinearLayout?
An activity is necessary, yes, when creating an android project. Each activity itself hosts a layout with setContentView(). If is possible to extend a LinearLayout in a separate class, then set it as the main content view inside of a separate activity:
You can then add the layout to your main layout: