2012-08-05 29 views
0

我正在这里创建相机应用程序。我设法点击图像并在ImageView中显示。我有一个ImageButton,点击它可以进入另一个页面。在另一页上,我想用Instagram上的一组可滚动图像来显示该图像。但我不能加载该图像在另一个XML文件。 帮助请。如何将一个xml文件中的图像加载到另一个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")); 
     } 
    }); 

}}

在其他I类创建此类变量,但我不能使用IV(其保持图像视图的绘制)。它只接受我认为的整数。我该怎么办?

回答

0

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

+0

你能给我一些示例代码吗? – maestrosan11 2012-08-05 12:39:45

+0

好吧,我从来没有用过相机来点击图片,告诉我点击图片后你会得到什么?你得到点击图像的URI吗?你用什么代码来设置ImgageView? – 2012-08-06 15:54:53

相关问题