如何从一个活动图像发送到另一个机器人?

如何从一个活动图像发送到另一个机器人?

问题描述:

我有一类和点击ImageView的一个对话框,显示它有两个选项,拍摄的图像从相机或打开设备的图像库中的ImageView的。我想从一个类发送图像到另一个,因此它可以出现在ImageView的。我从多小时寻找,但我只拿到大约从一个类发送文本数据another.Can任何一个讲述发送图像从一类到另一个?

I am having a imageView in one class and on clicking the imageView a dialog box appear which has two option to take a image from camera or open the image gallery of device. I want to send image from one class to another so it can appear in ImageView. I am searching from many hour but i got only about sending text data from one class to another.Can any one tell about sending an image from one class to another?

这是从发送方类code将于形象。

This is code from sender class which will take image.

   takeImg.setOnTouchListener(new OnTouchListener() {

            public boolean onTouch(View v, MotionEvent event) {
                // TODO Auto-generated method stub
                if(event.getAction() == event.ACTION_UP)
                {
                    i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                    startActivityForResult(i,cameraData);
                }
                return true;
            }
        });
    }
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        // TODO Auto-generated method stub
        super.onActivityResult(requestCode, resultCode, data);
        if(resultCode==RESULT_OK)
        {
            Bundle extras=data.getExtras();
            bmp=(Bitmap)extras.get("data");
        }
    }

有关任何帮助的感谢

我把你需要发送图像的路径从一个活动到另一个答案。 filepath是图片的路径。

I got the answer you need to send path of image from one activity to another. filePath is the path of image.

Intent open_displayPage=new Intent(MainActivity.this,display_page.class);
open_displayPage.putExtra("imagePath", filePath);

和获取路径的另一个活动

And get the path in another activity

final String path = getIntent().getStringExtra("imagePath");
org_bmp = BitmapFactory.decodeFile(path);