Wednesday, 4 February 2015

connection between activity and layout? how to change layout? how to start and destroy activity?



I'm total beginner with Android and Eclipse and I have few questions that will help me understand philosophy of Android:


1) activity does all the work "behind the scenes". Activity is connected to layout in xml file, when activity is started, if declared in setContentView method, connected layout will be shown. Activity can be independent, without any layout, it can be invoked by another activity and will do all the work without showing any layout. Activity is something like php file which is invoked my submit button in html, and layout is .html which shows elements.


Am I right with this one?


2) If I want to change layout of my app, for example I want to show Layout2.xml when clicking button in Layout1.xml. Then I have to destroy the activity which is connected with Layout1.xml and start activity which is connected with Layout2.xml? Is it correct? Is there any better way to do it?


3) How can I (by which method) destroy/stop certain activity?


Thank you in an advance.


No comments:

Post a Comment