Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
327 views
in Technique[技术] by (71.8m points)

android - How to pass image data from one activity to another activity?

I am using two activities. One activity displays images in a GridView and by clicking on a particular image in that GridView it should display the full screen image in another activity.

How can I achieve this?

My MyGridView.java

mGridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position,long id) {
    // TODO Auto-generated method stub
    Toast.makeText(getApplicationContext(), "Image"+(position+1),Toast.LENGTH_SHORT).show();
    System.out.println(id);
    Intent i = new Intent(this, MyImageViewActivity.class);
    Bundle bundle = new Bundle();
    bundle.putInt("image", position);
    i.putExtras(bundle);
    startActivityForResult(i, 0);
}
});
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Pass the image URL/Uri instead of passing raw image data.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...