我有两个活动;一个拍摄照片,另一个显示照片并在相对布局中放置标记。我通过一个Intent将第一个活动拍摄的图片发送给第二个,并将其解码为如下的Bitmap,但我仍然收到NullPointerException的任何帮助?: Edit1:当我使用png资源并将其添加到XML中时布局一切似乎是确定的。添加一张照相机拍摄的照片作为我的相对布局
Bitmap b = BitmapFactory.decodeByteArray(getIntent().getByteArrayExtra("byteArray"), 0, getIntent().getByteArrayExtra("byteArray").length);
Resources res = getResources();
Drawable bd = new BitmapDrawable(res,b);
RelativeLayout rl = (RelativeLayout) findViewById(R.id.touchanddrag);
rl.setBackground(bd)
setContentView(R.layout.touchanddrag);
你可以张贴logcat的? – SMR