0

我在这里创建一个相机应用程序。我设法单击图像并在 ImageView 中显示。我有一个 ImageButton,单击它可以将您带到另一个页面。在另一页上,我想用一组可滚动的图像显示该图像,例如在 Instagram 上。但我无法将该图像加载到另一个 xml 文件中。请帮忙。

代码:

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_select);

    // Image clicked...
    ImageView ivPic = (ImageView) findViewById (R.id.ivPic);

    // Image button to go to next page...
    ImageButton ib = (ImageButton) findViewById(R.id.ibNext);

    // Not sure if this is right.....
    Drawable iv = ivPic.getDrawable();


    ib.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            startActivity(new Intent("com.rating.bar.EFFECTS"));
        }
    });

}}

在另一个类中,我创建了这个类变量,但我不能使用 iv(它包含图像视图的可绘制对象)。它只接受我认为的整数。我应该怎么办?

4

1 回答 1

0

在您的 imagebutton 中读取图像的 URI/路径,并添加到调用下一个活动的意图的附加内容中,并在下一个活动中读取附加内容。

于 2012-08-05T09:26:46.060 回答