在将位图传递给imageview时获取空值

时间:2016-12-29 10:26:01

标签: android bitmap android-camera thumbnails video-thumbnails

我正在尝试将bitmap值传递给imageView,以便在video录制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 个答案:

没有答案