ActivityOne
I have 12 Imageviews. User click on either 1 of them. If they click ImageView 1, we assign a int value to it (image_id=1; )
ActivityTwo
Use a If else statement to check which image has they clicked
Intent result_intent=getIntent();
if (image_id==1) {
text.setText("U have clicked image "+image_id);
}
I need the int value in ActivityTwo as I need to calculate sth. Anyone can help? Thx
@gosulove
setOnClickListener
on your allImageViews
Like this In your Activity 1
Now inside your
onClick()
methodIn your Activity2
In ActivityOne, pass the value in this way:
In ActivityTwo, get the value in this way:
You can setOnClickListener on each imageView. In
onClick(View v)
method check the id of each imageview. that is in this way:Now you have to implements
View.OnClickListener
interface. After implementing this you have this method:Hope this will help you :)
Edit: for more about in button click visit here
Use Intent to pass the value to Activity2.
In Activity1:
In Activity2:
more detail