I want to create different view states for error and success of login page. For that I want to create the singe activity (login), Which will have email and password fields. After submitting the data if I'm getting success/error then I want to display different layout (not in different activity). How can I achieve that ? Simpy.. I need to display multiple layouts on single activity on changing its states.
Asked
Active
Viewed 86 times
-4
-
5Use [Fragments](https://developer.android.com/guide/components/fragments) – AskNilesh Oct 11 '18 at 09:21
-
you should use Fragments – Mehrdad Oct 11 '18 at 09:22
-
Yes using fragment is also an option. But I want to implement it using "merge" if possible. Do you have any idea of implementing that using merging layouts? – Galaxy Patel Oct 11 '18 at 09:46
1 Answers
0
ok here simple one , say you want three layouts : creates 3 linearLayouts or Relative layouts for every states by default set their visibility to gone and give them ids find them by id (findViewByID) and than in every state use linearLayout1.setVisibility(View.VISIBLE);
and the others
linearLayout2.setVisibility(View.GONE); linearLayout3.setVisibility(View.GONE);
and so on with every new state

Kmelliti
- 101
- 7
-
No I don't want to do that using visibility. Thanks for replying. I want to implement it using "merge" if possible. – Galaxy Patel Oct 11 '18 at 09:45
-
you can still add view programmatically in the activity if you dont want that – Kmelliti Oct 12 '18 at 11:09