android - call an imageView inside my .java class -
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#444548"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/image" > </imageview> <textview android:id="@+id/textview01" android:textcolor="#ffffff" android:layout_width="wrap_content" android:text="@+id/textview01" android:layout_height="wrap_content"> </textview> </linearlayout>
i m calling textview in .java class this:
textview tv1 = (textview) findviewbyid(r.id.textview01); tv1.settext("welcome schogini!");
is there way image too?thanks
ya sure.. can create object textview did above,and create folder named drawable under res folder , place image u need,and set image view image calling id drawable
for ex:
imageview im = (imageview) findviewbyid(r.id.my_image); im.setimage(r.drawable.name_of_image);
- without extension of image.
Comments
Post a Comment