I am trying to change the background image of an ImageView for different options on Radio buttons in the calling activity. The calling activity passes the parameters in a bundle to rendering activity and I am receiving the parameters properly (I get Curve1 and Curve2 as parameters in the rendering activity after making choice on radio buttons). But I am not able to change the image background either by setImageResource() or setBackgroundResource(). Here is the snippet doing that:
Rendering Activity
private void validateImage()
{ wave = (ImageView) findViewById(R.id.image_wave);
switch (extras.getString("Curve"))
{
case "Curve1":
wave.setB (R.drawable.sinewave1);
break;
case "Curve2":
wave.setImageResource(R.drawable.sinewave2);
break;
}
}
activity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="shantanu.concussion.usu.concussiontest.TestActivity">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/image_wave"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
Can anybody suggest what am I missing? Thanks :-)