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
java2-> xml2
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
putExtramethod 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
startActivityForResultinstead ofstartActivity.These two steps will solve your problem – in case that i’ve understand it right.