Q:

Android: How to preload views?

I am trying to make a game where in the start menu, when a button is clicked, a story event will be happening. There will be different stories when the button is clicked depending on the character the player is using,so I don't want to make a billion different activities/fragments for the stories.
I have two layouts that I want to switch within the same activity.
To switch from layout 1 to layout 2, I tried to add layout 2 to layout 1, and also tried ViewFlipper , but when I try to switch from Layout 1 to layout 2, the TextView in layout 2 says "New text" first before turning into what I want it to say. The textbox, which is supposed to be at the bottom, appears at the top first and then jumps to the bottom
I've also tried using threads to have layout 2 preload but that just messes up layout 2. So what should I do?
Here is my class for the story
public class Story extends FrameLayout {
    String[][] story;
    int H;
    int W;
    int L;
    int index =0;
    TextView text;
    ImageView character;
    View v;

Story(Context context,String[][]story,int length){
    super(context);
    this.story=story;
    this.L = length;
    init(context);
}
    public void init(Context context) {
        LayoutInflater l = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         v = l.inflate(R.layout.story, this, true);
        final RelativeLayout.LayoutParams textParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        final FrameLayout.LayoutParams imageParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        text = (TextView) v.findViewById(R.id.story);
        character = (ImageView) v.findViewById(R.id.chara);
        final RelativeLayout textBox = (RelativeLayout) v.findViewById(R.id.textbox);
        textBox.post(new Runnable() {
            @Override
            public void run() {
                H = textBox.getHeight();
                W = textBox.getWidth();
                textParams.setMargins(W / 12, H / 8, W / 10, H / 8);
                text.setLayoutParams(textParams);
                text.setText(story[index][0]);
            }
        });
        v.post(new Runnable() {
            @Override
            public void run() {
                int h = v.getHeight();
                imageParams.setMargins(W / 7 * 2, h / 10, 0, H / 3);
                character.setLayoutParams(imageParams);
                character.setImageResource(Integer.parseInt(story[index][1]));
            }
        });
    }
}

XML for the story
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
     >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/chara"
        android:scaleType="fitStart"
        android:adjustViewBounds="true"
        />
    <RelativeLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textbox"

        android:layout_gravity="bottom">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/vntextbox"
            android:adjustViewBounds="true"
            android:scaleType="fitEnd">

        </ImageView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/story" />
    </RelativeLayout>

</merge>

For each character, they have a method that returns their story, eg for a particular character : 
public class Player extends ImageView {  
    Context context;
    Player (Context context){
        super(context);
        this.context=context;
    }
public Story getIntro(){
    int normal = R.drawable.normal;
    int serious = R.drawable.serious;
    int happy = R.drawable.happy;
    final int length = 8;
    String[][] story = // a story
    final Story s = new Story(context, story, l);
            s.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                 //do some stuff
                }
    });
    return s;
}
}

And here is where the story is used
public class StartMenu extends AppCompatActivity {
   @Override
    protected void onCreate(final Bundle savedInstanceState){
       super.onCreate(savedInstanceState);

setContentView(R.layout.startmenu);
 final RelativeLayout r = (RelativeLayout)findViewById(R.id.startscreen);
       final Button b =new Button(this);
b.setOnClickListener(new View.OnClickListener() {
                         @Override
                         public void onClick(View v) {
                             //here I want to do something like this: (doesn't work due to problems described above)
                             Player p = new Player(StartMenu.this);
                             Story s = p.getIntro();
                             r.removeAllViews();
                             r.addView(s);
}
});

A:

Try to leave the text space empty on your .xml and just fill it when you're creating the activity (if it is dynamic). It will solve the text change flick.
About the two layouts, search about Fragments.

