Android resolveuri 在错误的位图 uri 上失败

Android resolveuri failed on bad bitmap uri

我是 android 的新手,正在尝试上传图库中的图片。好像我得到的路径没问题,但我不确定是否可以正确使用它来上传图片。

logcat 说:resolveUri 在错误的位图 uri 上失败:[/storage/sdcard0/VK/FjKgT9DodNM.jpg, 2130837564, 2130837563, 2130837565, 2130837566].

知道我做错了什么吗?

这里的 booksCovers 是一个带有图片的对象的 ArrayList。

    @Override
public boolean onContextItemSelected(MenuItem item) 
{
    switch (item.getItemId()) {
    case R.id.change_picture:
        onChangePictureClick();
        break;
    case R.id.delete_element:
        /*
        ...
        */
        break;
    default:
        break;
    }
    return super.onContextItemSelected(item);
};

private void onChangePictureClick()
{
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    startActivityForResult(Intent.createChooser(intent, "Select Picture"), CHANGE_PICTURE);
}

    @Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) 
{
    getMenuInflater().inflate(R.menu.list_view_contex_menu, menu);
    info = (AdapterView.AdapterContextMenuInfo) menuInfo;// contains information about object of which ContextMenu was called from
};

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) 
{
    if (resultCode == RESULT_OK)
    {
        switch (requestCode) 
        {
        case INPUT_ACTIVITY:
            /*
            ...
            */
            break;
        case CHANGE_PICTURE:
            Uri selectedImage = data.getData();
            String[] filePathColumn = {MediaStore.Images.Media.DATA};
            Cursor cursor = getContentResolver().query(selectedImage, 
                    filePathColumn, null, null, null);
            cursor.moveToFirst();
            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String picturePath = cursor.getString(columnIndex);
            cursor.close();

            booksCovers.set(info.position, picturePath);
            HashMap<String, Object> hashMap = booksArray.get(info.position);
            hashMap.remove(coverkey);
            hashMap.put(coverkey, booksCovers);
            booksArray.set(info.position, hashMap);
            listAdapter.notifyDataSetChanged();
        }
    }
};

现在可以使用了。刚刚更改了这个:

hashMap.put(coverkey, booksCovers.get(info.position));