arun
arun

Reputation: 227

Whether it is possible to use two activities with same layout

Whether it is possible one layout can be called by two activities.

Say i have a textview and a button. 1) Using one activity i set the textView with a name 2) Using another activity, is it possible to display popup message when i click the button.

first activity should set the textview alone and second activity should be called when i click the button. Because, i will get the text from api webservice call in first activity and will display message in popup window using another activity using some other api webservice call.

Upvotes: 1

Views: 2040

Answers (3)

sumeet
sumeet

Reputation: 543

No problem, you can easily use same layout file for more then one activity. First try to implement this thing in your project, and then see, what happening.

Thanks, Sumeet.

Upvotes: 1

adonal3
adonal3

Reputation: 268

Yes. Two activities don't care if they are using the same layout, and in fact don't really know about it. You can use view.setVisibility to make certain views invisible or visible, and as long as you are using the ids associated with the views can make different calls on them in the activities.

So the answer is yes, you can manipulate that layout however you like in two different activities.

Upvotes: 1

Hamad
Hamad

Reputation: 5152

yes you can use one layout for two activities,but in that case where you use same controls for both activites:

like activity one: uses both one textView and Button

like activity two: uses both one textView and Button

Upvotes: 2

Related Questions