I want to use a command like this:
ImageView image = (ImageView) findViewById(R.id.x2);
where should I put in the file main.xml the following piece of code?
<ImageView
android:id="@+id/x2"
android:src="@drawable/book"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Dheeresh Singh is ok.
main.xml:
If you want to position the image in a different place, you can modify different attributes
For more information about this, look at the android tutorials
http://developer.android.com/reference/android/widget/ImageView.html (for ImageView attributes)
http://developer.android.com/resources/tutorials/views/index.html (for view info)
Excuse me for my english.
Good Luck!