I have an application where the main layout is loaded from xml file.
The layout loaded is :
A relative layout with 5 button. When user click on the button appear a menu, where he can choose a type of view. After choosing view, button will invisible and appears chosen view.
After restarting the application , system load default layout ( relative layout with 5 button).
I want that when the application restart the system load the last selected layout.
Is it possible to do?
You should be able to do this by using Shared Preferences in Android: http://developer.android.com/guide/topics/data/data-storage.html#pref
You may store a boolean value to track the state of the layout (whether it is the RelativeLayout with 5 Buttons, or the View chosen state with 4 Buttons). This way when you load the activity, you can first check this flag to determine which layout you want to load. You can also use the preference such that you do not need to initialize this flag variable, but instead you can use a default value.
And in your OnClickListener for the button A:
The other onClick() method for the other buttons could be implemented similarly.
Edit: Updated to use an integer rather than a boolean