I have some problems with the layout and activity and I don't know are they different,are they related? I think the layout is a place we can add or remove our views and activity is just a place that shows any thing in our layout, is this true?
is an instance of Activity, a class in the Android SDK. An activity is responsible for managing user interaction with a screen of information. You write subclasses of Activity to implement the functionality that your app requires. A simple application may need only one subclass; a complex application can have many.
defines a set of user interface objects and their position on the screen. A layout is made up of definitions written in XML. Each definition is used to create an object that appears on screen, like a button or some text.
A layout deals with the user interface. Its where you set all your views that will be visible on the user interface.
The code behind (.java) sets the layout you created as the content view and manipulates the behavior of the views you have set. For example, sets the text for a text view.
The activity then is the whole thing, the layout and the code behind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With