Dynamical change the background resouce

Hello,
I'm currently setting the background parent resource, and only layout, like this which works:

// Set background through the preferences if (prefs.getString("listPref", "").equals("RedHouse")) { linearLayout = (LinearLayout) this.findViewById(R.id.LinearLayout01); linearLayout.startAnimation(myFadeInAnimation); // Set animation to linearLayout.setBackgroundResource(R.drawable.redhouse); }

I want to use ViewFlipper or some other widget to flip through multiple red house png files without disrupting the textviews.

I attempted the below code snippet but I couldn't get the LinearLayout background set.

Main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:id="@+id/LinearLayout01">

<TextView android:id="@+id/textview" android:textSize="20dip"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:text="TEST!!!" android:background="#0000ff" />
        <TextView android:gravity="center_vertical|center_horizontal"
        android:id="@+id/textview1" android:textSize="100sp"
        android:textColor="#ffffff00"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:text="100"
        android:layout_gravity="center_horizontal" />

<ViewFlipper android:id="@+id/ViewFlipper01"
            android:layout_width="fill_parent" android:layout_height="fill_parent">
            <!--adding views to ViewFlipper-->
            <ImageView android:id="@+id/ImageView01" android:layout_width="fill_parent"
                android:layout_height="fill_parent" android:text="Flipper Content 1" android:src="@drawable/redhouse"></ImageView>
            <ImageView android:id="@+id/ImageView02" android:layout_width="fill_parent"
                android:layout_height="fill_parent" android:text="Flipper Content 2" android:src="@drawable/redhouse1"></ImageView>
            <ImageView android:id="@+id/ImageView03" android:layout_width="fill_parent"
                android:layout_height="fill_parent" android:text="Flipper Content 3"></ImageView>


</ViewFlipper>


</LinearLayout>

java file: public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main);

    flipper = (ViewFlipper) findViewById(R.id.ViewFlipper01);
    flipper.setFlipInterval(2000);
    flipper.startFlipping();
}

}

The above behavior will show the images underneath the TextView of "100". It needs to be set the entire background of the activity so that the TextView is on top. I attempted to put the TextView inside of the ViewFlipper but that didn't get the desired behavior.
Any ideas?

Thanks in advance.
sdittmannAsked:
Who is Participating?
 
sdittmannAuthor Commented:
I solved this issue using the async task.  Within this task I dynamically change the background images.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.