Hope You Are Fine Well am stuck in a little bit of problem...I have a main activity in which i am using custom listview(showing movie_poster,movie_name,movie_rating)...and i want that if i click on a row a new activity should be open and jpeg image (movie_poster)in that row should be show in other activity...i tried a lot of things but could not find a solution..
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent=new
Intent(MainActivity.this,Description_Activity.class);
int index= (int)parent.getItemIdAtPosition(position);
String description=movie_descriptions[index];
intent.putExtra("title",movie_titles[index]);
intent.putExtra("rating",movie_ratings[index]);
intent.putExtra("desc", description);
startActivity(intent);
}
});
答案 0 :(得分:1)
When you click on row Send Image path to activity using intent.
intent.putExtra("title",movie_titles[index]);
intent.putExtra("rating",movie_ratings[index]);
intent.putExtra("desc", description);
intent.putExtra("resourseInt", R.drawable.image);
startActivity(intent);
On Second activity
int res = extras.getInt("resourseInt");
ImageView view = (ImageView) findViewById(R.id.something);
view.setImageResourse(res);
答案 1 :(得分:1)
您无法自行发送图像,您必须从SD卡发送图像URL,资源ID或路径。
答案 2 :(得分:0)
Where is the image coming from? If its a url pass the url or its its coming from local disk, then pass the disk path:
intent.putExtra("image",<your_url_or_path>);
And then use this url or path in your second activity to show the image wherever you want to show it.