活动不适用于resultCode 4 5 6

时间:2016-05-10 14:57:39

标签: android camera

我从图库中选择图片并在图片按钮上显示的活动不适用于请求代码3 4 5这里是我的活动结果代码

protected void onActivityResult(int requestCode, int resultCode,Intent data) {


    //getting uri from intent extras


        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();
        btmp[requestCode]= BitmapFactory.decodeFile(picturePath);


    switch (requestCode){
        case 0:
            img1.setImageBitmap(BitmapFactory.decodeFile(picturePath));
            bt1=BitmapFactory.decodeFile(picturePath);
            break;
        case 1:
            img2.setImageBitmap(BitmapFactory.decodeFile(picturePath));
            bt2=BitmapFactory.decodeFile(picturePath);
            break;
        case 2:
            img3.setImageBitmap(BitmapFactory.decodeFile(picturePath));
            bt3=BitmapFactory.decodeFile(picturePath);
            break;
        case 3:
            bt4=BitmapFactory.decodeFile(picturePath);
            img4.setImageBitmap(BitmapFactory.decodeFile(picturePath));
            break;
        case 4:
            bt5=BitmapFactory.decodeFile(picturePath);
            img5.setImageBitmap(BitmapFactory.decodeFile(picturePath));
            break;
        case 5:
            bt6=BitmapFactory.decodeFile(picturePath);
            img6.setImageBitmap(BitmapFactory.decodeFile(picturePath));
            break;
    }


}

0 个答案:

没有答案