tags:

views:

165

answers:

0

Hi-

I am trying to display the image on the screen using ImageView. setImageResource fails. Here is my XML :

<FrameLayout
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:layout_weight="1">
 <ImageView 
     id="@+id/batteryLevelview" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center"/>
</FrameLayout>

@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView batteryLevelImage = (ImageView) findViewById(R.id.batteryLevelview); batteryLevelImage.setImageResource(R.drawable.notconnected); }

What's wrong in my code? Can you please help me to find what's wrong. I would like to update image on the ImageView object based on criteria. I tried using LinearLayout and that did not help.

thanks