XML : Drawable not displaying in ImageView

Hello I am running into a silly error and I think I might be missing something. I currently have a list of objects. The objects have a title, description and an image. The title and description display properly, but for some reason the Image won't. I added the objects on another activity and made a list, when the user selects the item they wanted to see it send the id to this new page where it pulls the object. I added a random image as jpg to the application to see if it pulse and it does, but it looks a little weird. Any ideas why the images won't be pulling from the list? Thank you in advance.

XML:

  <?xml version="1.0" encoding="utf-8"?>      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_width="match_parent" android:layout_height="match_parent">    <ImageView      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:id="@+id/img"      android:src="@drawable/img"      android:layout_alignParentTop="true"      android:layout_alignParentStart="false"      android:layout_alignParentLeft="true"      android:layout_alignParentRight="true" />    <TextView      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:textAppearance="?android:attr/textAppearanceLarge"      android:text="News Title"      android:id="@+id/title"      android:layout_below="@+id/img"      android:layout_alignParentLeft="false"      android:layout_alignParentRight="false"      android:layout_centerInParent="true" />    <TextView      android:layout_width="wrap_content"      android:layout_height="wrap_content"      android:textAppearance="?android:attr/textAppearanceMedium"      android:text="Medium Text"      android:id="@+id/desc"      android:layout_below="@+id/title"      android:layout_alignParentStart="true"      android:layout_alignParentEnd="true"      android:layout_alignParentLeft="true"      android:layout_alignParentRight="true" />  </RelativeLayout>    

JAVA:

  CustomOBJ selOBJ = null;  @Override  protected void onCreate(Bundle savedInstanceState) {      super.onCreate(savedInstanceState);      setContentView(R.layout.det);      Bundle objID = getIntent().getExtras();      for(int x = 0; x < MainActivity.listobjs.size(); x++){          if (MainActivity.listobjs.get(x).getID().equals(objID.getString("object") )){              selOBJ = MainActivity.listobjs.get(x);              break;          }      }        TextView Title =(TextView)findViewById(R.id.title);      TextView description = (TextView)findViewById(R.id.desc);      ImageView objPic=(ImageView)findViewById(R.id.img);        Title.setText(selOBJ.getName());      description.setText(selOBJ.getDescription());      objPic.setImageDrawable(selOBJ.getObjPic());    }    

No comments:

Post a Comment