private void initViews() { tvTitle = (TextView) findViewById(R.id.tvTitle); tvTitle.setText(mNote.getTitle()); tvViewCategory = (TextView) findViewById(R.id.tvViewCategory); tvViewCategory.setText(mNote.getCategory()); tvContent = (TextView) findViewById(R.id.tvContent); tvContent.setText(mNote.getContent()); ivShowPhoto = (ImageView) findViewById(R.id.ivShowPhoto); String imagePath = mNote.getImagePath(); if (!TextUtils.isEmpty(imagePath)) { BitmapUtils bitmapUtils = new BitmapUtils(this); bitmapUtils.display(ivShowPhoto, imagePath); ivShowPhoto.setVisibility(View.VISIBLE); } vvViewVideo = (VideoView) findViewById(R.id.vvViewVideo); String videoPath = mNote.getVideoPath(); if (!TextUtils.isEmpty(videoPath)) { vvViewVideo.setVideoURI(Uri.parse(videoPath)); vvViewVideo.setVisibility(View.VISIBLE); if (!vvViewVideo.isPlaying()) { vvViewVideo.start(); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == VIEW_REQUEST_CODE && resultCode == RESULT_OK) { // Note note = (Note) data.getSerializableExtra("request_note"); mNote = (Note) data.getSerializableExtra("request_note"); tvTitle.setText(mNote.getTitle()); tvContent.setText(mNote.getContent()); tvViewCategory.setText(mNote.getCategory()); String imagePath = mNote.getImagePath(); // System.out.println("imagePath: " + imagePath); if (!TextUtils.isEmpty(imagePath)) { BitmapUtils bitmapUtils = new BitmapUtils(this); bitmapUtils.display(ivShowPhoto, imagePath); ivShowPhoto.setVisibility(View.VISIBLE); } String videoPath = mNote.getVideoPath(); if (!TextUtils.isEmpty(videoPath)) { vvViewVideo.setVideoURI(Uri.parse(videoPath)); vvViewVideo.setVisibility(View.VISIBLE); if (!vvViewVideo.isPlaying()) { vvViewVideo.start(); } } } }