当我使用Intent.getExtras时遇到NullPointerException

时间:2013-04-23 10:59:32

标签: android android-intent nullpointerexception

在方法performCrop()中,代码如下:

public void performCrop() {
    try {
        Intent cropIntent = new Intent("com.android.camera.action.CROP");
        cropIntent.setDataAndType(picUri, "image/*");
        cropIntent.putExtra("crop", "true");
        ...
        startActivityForResult(cropIntent, PIC_CROP);
    } catch (ActivityNotFoundException anfe) {
        ...
    }

在方法onActivityResult中,代码:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    ...
    Bundle extras = data.getExtras();//Here occurs the exception
    ...
    }
}

0 个答案:

没有答案