Sounds like _image is null.
On Wednesday, February 6, 2013 1:42:00 PM UTC-6, jagadeesh babu wrote:
>
> Iam capturing image and saving to sd card,after capturing image app get
> crashes can any one guide me.
>
>
>
> *public* *class* ButtonClickHandler *implements* View.OnClickListener {
>
> *public* *void* onClick(View view) {
>
> Log.*i*("MakeMachine", "ButtonClickHandler.onClick()"
> );
>
> startCameraActivity();
>
> }
>
> }
>
>
>
> *protected* *void* startCameraActivity() {
>
> Log.*i*("MakeMachine", "startCameraActivity()");
>
> file = *new* File(_path);
>
> Uri outputFileUri = Uri.*fromFile*(file);
>
>
>
> Intent intent = *new* Intent(
>
> android.provider.MediaStore.*
> ACTION_IMAGE_CAPTURE*);
>
> intent.putExtra(MediaStore.*EXTRA_OUTPUT*, outputFileUri);
>
>
>
> startActivityForResult(intent, 0);
>
> }
>
>
>
> @Override
>
> *protected* *void* onActivityResult(*int* requestCode,
> *int*resultCode, Intent data) {
>
> Log.*i*("MakeMachine", "resultCode: " + resultCode);
>
> *switch* (resultCode) {
>
> *case* 0:
>
> Log.*i*("MakeMachine", "User cancelled");
>
> *break*;
>
>
>
> *case* 1:
>
> onPhotoTaken();
>
> *break*;
>
> }
>
> }
>
>
>
> *protected* *void* onPhotoTaken() {
>
> Log.*i*("MakeMachine", "onPhotoTaken");
>
>
>
> _taken = *true*;
>
>
>
> BitmapFactory.Options options = *new*BitmapFactory.Options();
>
> options.inSampleSize = 4;
>
>
>
> Bitmap bitmap = BitmapFactory.*decodeFile*(_path, options);
>
>
>
> _image.setImageBitmap(bitmap);
>
>
>
> _field.setVisibility(View.*GONE*);
>
> }
>
>
>
> @Override
>
> *protected* *void* onRestoreInstanceState(Bundle
> savedInstanceState) {
>
> Log.*i*("MakeMachine", "onRestoreInstanceState()");
>
> *if* (savedInstanceState.getBoolean(Demo_ad_sdkActivity.*
> PHOTO_TAKEN*)) {
>
> onPhotoTaken();
>
> }
>
> }
>
>
>
> @Override
>
> *protected* *void* onSaveInstanceState(Bundle outState) {
>
> outState.putBoolean(Demo_ad_sdkActivity.*PHOTO_TAKEN*,
> _taken);
>
> }
>
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.