Im my android project i have 2 java class and 2 xml file. each java class only can see one of the xml file because of setcontentView)();
java1 -> xml1
i have to see the imageView1 at java2 class but the imageview is at xml1 so the class cant see it. What should i to ?
If you are calling the java2 activity from java1 (or backwards), then you can use the Intent's
putExtra method to pass any value you want from your first activity to the second.
If you need this relation to work backwards too, you should call
startActivityForResult instead of
These two steps will solve your problem - in case that i've understand it right.
If this is a control in a different layout, it won't exist, so knowing the ID (even though that's easy to get) won't help you at all.