English 中文(简体)
我的摄像应用使三星银星S失去价值
原标题:My camera application giving null value in Samsung Galaxy S

我研制了一台带有违约照相机的照相机。 这一应用在所有其他安乐器中运行,但与三星银星S公司存在一些问题。

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);

这项法典正在取得结果,我正在获得一张图象。 但我无法从中找到一个形象的道路。

我请EXTRA_OUTPUT 恢复无效价值。 因此,我可以先界定档案路线和名称,然后打电话照相。 当我们利用这一应用来了解情况时,银河S在缺省地点拯救了这一局面,而没有拯救到预先确定的地点。

如果任何人都这样做,请帮助我。

问题回答

What I ve done for this is define a location for EXTRA_OUTPUT as a Uri, cache that in a static or member variable, and then in onActivity result use the cached location to retrieve the image. I had the same problem you were describing, and this seems to work fine. The only drawback is having 2 copies of the image, one in the location you defined in EXTRA_OUTPUT, and one in the default location.

http://www.ohchr.org。

AndroidCameraUtils - Download the project and from library project by including it below is the code snippet you can use !

 private void setupCameraIntentHelper() {
    mCameraIntentHelper = new CameraIntentHelper(this, new CameraIntentHelperCallback() {
        @Override
        public void onPhotoUriFound(Date dateCameraIntentStarted, Uri photoUri, int rotateXDegrees) {
            messageView.setText(getString(R.string.activity_camera_intent_photo_uri_found) + photoUri.toString());

            Bitmap photo = BitmapHelper.readBitmap(CameraIntentActivity.this, photoUri);
            if (photo != null) {
                photo = BitmapHelper.shrinkBitmap(photo, 300, rotateXDegrees);
                ImageView imageView = (ImageView) findViewById(de.ecotastic.android.camerautil.sample.R.id.activity_camera_intent_image_view);
                imageView.setImageBitmap(photo);
            }
        }

        @Override
        public void deletePhotoWithUri(Uri photoUri) {
            BitmapHelper.deleteImageWithUriIfExists(photoUri, CameraIntentActivity.this);
        }

        @Override
        public void onSdCardNotMounted() {
            Toast.makeText(getApplicationContext(), getString(R.string.error_sd_card_not_mounted), Toast.LENGTH_LONG).show();
        }

        @Override
        public void onCanceled() {
            Toast.makeText(getApplicationContext(), getString(R.string.warning_camera_intent_canceled), Toast.LENGTH_LONG).show();
        }

        @Override
        public void onCouldNotTakePhoto() {
            Toast.makeText(getApplicationContext(), getString(R.string.error_could_not_take_photo), Toast.LENGTH_LONG).show();
        }

        @Override
        public void onPhotoUriNotFound() {
            messageView.setText(getString(R.string.activity_camera_intent_photo_uri_not_found));
        }

        @Override
        public void logException(Exception e) {
            Toast.makeText(getApplicationContext(), getString(R.string.error_sth_went_wrong), Toast.LENGTH_LONG).show();
            Log.d(getClass().getName(), e.getMessage());
        }
    });
}

@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);
    mCameraIntentHelper.onSaveInstanceState(savedInstanceState);
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mCameraIntentHelper.onRestoreInstanceState(savedInstanceState);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    mCameraIntentHelper.onActivityResult(requestCode, resultCode, intent);
}
}
  • Add below lined to manifest file of your activityandroid:configChanges="keyboardHidden|orientation|screenSize"

<>0>>> 我尝试了许多照相机和助听器的事例,但对于开端人和没有太多核心概念的人来说,该项目更为舒适。 THanks!





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签