Update or change images in View during runtime
<p>I have a little problem updating UI in OnClick Event.</p>

<p>When I do this:</p>

<pre><code>case R.id.radStripMiningCoal :
    {    
        LinearLayout testLayout = (LinearLayout)findViewById(R.id.layouttest);
        LinearLayout layout3 = (LinearLayout)findViewById(R.id.layout2);
        LinearLayout layout4 = (LinearLayout)findViewById(R.id.layout3);
        LinearLayout layout = (LinearLayout)findViewById(R.id.recomended);
        LinearLayout layout2 = (LinearLayout)findViewById(R.id.basic);


        int origWidth = getWindowManager().getDefaultDisplay().getWidth();


        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(origWidth,LayoutParams.WRAP_CONTENT);
        layout2.setLayoutParams(params);
        layout.setLayoutParams(params);
        testLayout.setLayoutParams(params);
        layout3.setLayoutParams(params);
        layout4.setLayoutParams(params);

        stripminingcoal.setVisibility(View.VISIBLE);
        VSLists.setVisibility(View.GONE);
        Next.setVisibility(View.GONE);

            AnimationDrawable animation = new AnimationDrawable();

            animation.addFrame(getResources().getDrawable(R.drawable.multispd1), 5000);
            animation.addFrame(getResources().getDrawable(R.drawable.img1), 5000);
            animation.addFrame(getResources().getDrawable(R.drawable.shocktubecluster1), 5000);
            animation.setOneShot(false);

            ImageView imageAnim =  (ImageView) findViewById(R.id.imgBasicIS);           
            imageAnim.setBackgroundDrawable(animation);            
            animation.start();

            AnimationDrawable animation2 = new AnimationDrawable();
            animation2.addFrame(getResources().getDrawable(R.drawable.unidelaysp), 5000);
            animation2.addFrame(getResources().getDrawable(R.drawable.trunkline), 5000);                
            animation2.setOneShot(false);

            ImageView imageAnim2 =  (ImageView) findViewById(R.id.imgRecomendedIS);         
            imageAnim2.setBackgroundDrawable(animation2);             
            animation2.start();

            AnimationDrawable animation3 = new AnimationDrawable();

            animation3.addFrame(getResources().getDrawable(R.drawable.leadin2), 5000);  
            animation3.addFrame(getResources().getDrawable(R.drawable.tubestarter),5000);
            animation3.setOneShot(false);
            ImageView imageAnim3 =  (ImageView) findViewById(R.id.imgRecomendedBSS);            
            imageAnim3.setBackgroundDrawable(animation3);           
            animation3.start();

            txtBasicIS.setText("Shock Tube Multi SPD / Detonating Cord / Cluster");   
            txtRecomendedIS.setText("Shock Tube Uni-Delay SP / Trunkline");
            txtRecomendedBSS.setText("Lead-In Line / Electric Shock Tube Starter"); 
</code></pre>

<p>Everything updates and displays fine.
But s soon as I do the same code in a different on "case" it does not update the images to the new images:</p>

<pre><code>    case R.id.radNarrowReefGold:
    {
        LinearLayout testLayout = (LinearLayout)findViewById(R.id.layouttest);
        LinearLayout layout3 = (LinearLayout)findViewById(R.id.layout2);
        LinearLayout layout4 = (LinearLayout)findViewById(R.id.layout3);
        LinearLayout layout = (LinearLayout)findViewById(R.id.recomended);
        LinearLayout layout2 = (LinearLayout)findViewById(R.id.basic);


        int origWidth = getWindowManager().getDefaultDisplay().getWidth();


        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(origWidth,LayoutParams.WRAP_CONTENT);
        layout2.setLayoutParams(params);
        layout.setLayoutParams(params);
        testLayout.setLayoutParams(params);
        layout3.setLayoutParams(params);
        layout4.setLayoutParams(params);

        stripminingcoal.setVisibility(View.VISIBLE);
        VSLists.setVisibility(View.GONE);
        Next.setVisibility(View.GONE);

            AnimationDrawable animation = new AnimationDrawable();

            animation.addFrame(getResources().getDrawable(R.drawable.udlp3), 5000);
            animation.addFrame(getResources().getDrawable(R.drawable.udlp6), 5000);
            animation.addFrame(getResources().getDrawable(R.drawable.trunkline), 5000);
            animation.setOneShot(false);

            ImageView imageAnim =  (ImageView) findViewById(R.id.imgBasicIS);           
            imageAnim.setBackgroundDrawable(animation);            
            animation.start();

            AnimationDrawable animation2 = new AnimationDrawable();
            animation2.addFrame(getResources().getDrawable(R.drawable.udlp3vivid), 5000);
            animation2.addFrame(getResources().getDrawable(R.drawable.udlp6vivid), 5000);   
            animation2.addFrame(getResources().getDrawable(R.drawable.trunkline), 5000);                
            animation2.setOneShot(false);

            ImageView imageAnim2 =  (ImageView) findViewById(R.id.imgRecomendedIS);         
            imageAnim2.setBackgroundDrawable(animation2);             
            animation2.start();

            AnimationDrawable animation3 = new AnimationDrawable();

            animation3.addFrame(getResources().getDrawable(R.drawable.leadin2), 5000);  
            animation3.addFrame(getResources().getDrawable(R.drawable.tubestarter),5000);
            animation3.setOneShot(false);
            ImageView imageAnim3 =  (ImageView) findViewById(R.id.imgRecomendedBSS);            
            imageAnim3.setBackgroundDrawable(animation3);           
            animation3.start();

            txtBasicIS.setText("Uni-Delay LP (3) / Uni-Delay LP (6) / Trunkline");   
            txtRecomendedIS.setText("Shock Tube Uni-Delay SP / Trunkline");
            txtRecomendedBSS.setText("Lead-In Line / Electric Shock Tube Starter"); 
    }
</code></pre>

<p>What am I missing or doing wrong?</p>

<p>The textViews does not change either.</p>

<p>Thanks in advance.
Patrick</p>
