Back to project page UniversalImagePick.
The source code is released under:
Apache License
If you think the Android project UniversalImagePick 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.luffyjet.universalimagepick; /*ww w .jav a2 s. c o m*/ import java.io.File; import com.luffyjet.universalimagepick.utils.LogUtil; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.widget.ImageView; import android.widget.ImageView.ScaleType; import android.widget.Toast; public class Test extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Bitmap bitmap = MainActivity.mBitmap; Intent intent = getIntent(); Uri uri = intent.getParcelableExtra("uri"); File file = new File(uri.getPath()); Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); long size = file.length()/1024; LogUtil.showLog("???????: "+size+"K"); ImageView imageView = new ImageView(this); imageView.setScaleType(ScaleType.CENTER); imageView.setImageBitmap(bitmap); setContentView(imageView); // Toast.makeText(this, bitmap.getWidth() + "/" + bitmap.getHeight() + " size: " + size, 3000).show(); } public long getBitmapsize(Bitmap bitmap) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { // return bitmap.getByteCount(); // } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); } }