Agniveer Kranti
Agniveer Kranti

Reputation: 117

Is it okay to use the same layout for two different activities?

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

    <Button
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="92dp"
    android:text="Start Download" />


  </LinearLayout>

Both activities have to perform the same things.The only difference is the type of data they handles. Just for curiosity I am asking this question.

Upvotes: 2

Views: 1117

Answers (1)

Gabe Sechan
Gabe Sechan

Reputation: 93728

Yes, there's no problem with that technically. Just remember that if you change anything for one activity it will change for both, so its best suited for very simple layouts. But frequently I'll use the same placeholder for 4 or 5 activities that aren't written yet, or I'll use the same layout for placeholder listview elements.

Upvotes: 2

Related Questions