Back to project page notes.
The source code is released under:
Apache License
If you think the Android project notes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.donnemartin.android.notes.notes; /*from www. j av a 2 s .c o m*/ import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; public class ImageFragment extends DialogFragment { public static final String EXTRA_IMAGE_PATH = "com.donnemartin.android.notes.path"; public static ImageFragment newInstance(String imagePath) { Bundle args = new Bundle(); args.putSerializable(EXTRA_IMAGE_PATH, imagePath); ImageFragment fragment = new ImageFragment(); fragment.setArguments(args); fragment.setStyle(DialogFragment.STYLE_NO_TITLE, 0); return fragment; } private ImageView mImageView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { mImageView = new ImageView(getActivity()); String path = (String)getArguments().getSerializable(EXTRA_IMAGE_PATH); BitmapDrawable image = PictureUtils.getScaledDrawable(getActivity(), path); mImageView.setImageDrawable(image); return mImageView; } @Override public void onDestroyView() { super.onDestroyView(); PictureUtils.cleanImageView(mImageView); } }