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. ja v a 2 s . co m import java.io.File; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.Button; import android.widget.ImageView; import com.luffyjet.universalimagepick.widget.CropImageView; public class MainActivity extends Activity { Button cutBtn; CropImageView maskView; public static Bitmap mBitmap; private String path = "/mnt/sdcard/"; protected int i; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ????? requestWindowFeature(Window.FEATURE_NO_TITLE); // ????? // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); cutBtn = (Button) findViewById(R.id.cut_btn); maskView = (CropImageView) findViewById(R.id.maskview); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.a402645); maskView.setImageBitmap(bitmap); cutBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { i++; File file = new File(path+"crop_"+i+".jpg"); Uri uri = maskView.saveCropBitmap(file); Intent intent = new Intent(MainActivity.this, Test.class); intent.putExtra("uri", uri); startActivity(intent); } }); } @Override protected void onDestroy() { super.onDestroy(); } }