Getting null value while passing a bitmap to imageview

330 views Asked by At

I am trying to pass a bitmap value to an imageView to show it on camera screen as thumbnail just after a video is recorded from camera.(I am trying to build a custom camera)

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    createVideoFolder();

    mMediaRecorder = new MediaRecorder();
    mChronometer = (Chronometer) findViewById(R.id.chronometer);

    mTextureView = (TextureView) findViewById(R.id.textureView);

    mRecordImageButton = (ImageButton) findViewById(R.id.videoButton);
    mRecordImageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mIsRecording) {
                mChronometer.stop();
                mChronometer.setVisibility(View.INVISIBLE);
                mIsRecording = false;
                mRecordImageButton.setImageResource(R.mipmap.start_recording);
                //Toast.makeText(getApplicationContext(),"Started",Toast.LENGTH_SHORT).show();
                mMediaRecorder.stop();
                mMediaRecorder.reset();


                Bitmap thumb = ThumbnailUtils.createVideoThumbnail(mVideoFileName , MediaStore.Video.Thumbnails.MINI_KIND);
                mImageView = (ImageView) findViewById(R.id.bitmapView);      // in this line i am getting null value
                mImageView.setImageBitmap(thumb);
0

There are 0 answers