Android 如果想要画廊,如何使用OnConfiguration Changed?

Android 如果想要画廊,如何使用OnConfiguration Changed?,android,android-gallery,Android,Android Gallery,在我的应用程序中,我为用户提供了一个选项,使用内置的相机和图库功能,并设置相同的意图,从图库中选择图片或从相机中单击图片。不知何故,在方向改变时,我丢失了这些意图传递的数据。在查找之后,我知道方向更改会导致活动重新绘制和重新初始化。现在我想使用Bundle和OnConfigurationChange并保存我的附加内容。我对如何实现这一目标一无所知,详细的回答可能会有所帮助。下面是我的代码: if(i==0){ Intent cameraIntent = new Intent(androi

在我的应用程序中,我为用户提供了一个选项,使用内置的相机和图库功能,并设置相同的意图,从图库中选择图片或从相机中单击图片。不知何故,在方向改变时,我丢失了这些意图传递的数据。在查找之后,我知道方向更改会导致活动重新绘制和重新初始化。现在我想使用Bundle和OnConfigurationChange并保存我的附加内容。我对如何实现这一目标一无所知,详细的回答可能会有所帮助。下面是我的代码:

if(i==0){
    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
    startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); 
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
    if( requestCode == 1337 && resultCode== Activity.RESULT_OK) {
        Bundle extras = data.getExtras();

        if (extras != null){
            TitmapFactory.Options options = new TitmapFactory.Options();
            options.inSampleSize = 1;
            options.inPurgeable = true;
            options.inInputShareable = true;
            thumbnail = (Titmap) data.getExtras().get("data");
            // imgview.setImageTitmap(thumbnail);
            image(thumbnail);

        } else {
            Toast.makeText(CreateProfile.this, "Picture NOt taken", Toast.LENGTH_LONG).show();
        }
        super.onActivityResult(requestCode, resultCode, data);     
    }
}






     if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data){

         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();

            thumbnail = (BitmapFactory.decodeFile(picturePath));



            image(thumbnail);

     }

这个活动的标签在mainfest中是什么样子的?我已经将其修改为android:configChanges=“keyboardHidden | orientation”,但这两个选项都不起作用。它在戴尔XCD35和HTC Wildfire S等手机上运行良好,但在三星设备上却无法正常工作。隐马尔可夫模型。。。有趣。我正在为HTC和三星安装设备驱动程序,将发布日志。在安装驱动程序时,我知道错误完全不同,这是一个虚拟机预算问题,我已经解决了。谢谢:)