I have been working on a e-commerce application for a while, and now I have a ListView that displays a list of products - Each products = 1 ImageView and some TextViews-.
I set an onItemClick listener on that ListView, the event that I want to occur when I click on one of that listView products is, Start the i new Activity, 'ProductDetails' that displays more informations on the product I have clicked on.
I have already asked this question somewhere else, but I didn't get a clear answer, They said that I have to create a new 'list\details' project, but this can't happen now, as I've working on that project for like 20 days, and can't start all over again.
You can't send a TextView
or an ImageView
from Activity
to Activity
. what you can send instead is it's contents. so for example if you want to pass the information from the TextView
you will need to pass the source String
that is displayed there (Or extract the String
from the TextView
) you do that by passing a Bundle
from the calling Activity
to the invoked one or simply by putting it as an Extra
:
intent.putExtra("string name", value);
and in the following Activity
you get this data:
Intent intent = getIntent();
bundle = intent.getExtras();
bundle.getString("string name");
Then in the following Activity
create a TextView
with the passed String
.
Same way is handled with the ImageView
by passing the it's path.