/*protected void doTakePhoto() {
try {
// Launch camera to take photo for selected contact final Intent intent = getTakePickIntent(mCurrentPhotoFile);
startActivityForResult(intent, CAMERA_WITH_DATA);
} catch (ActivityNotFoundException e) {

}
}
public static Intent getTakePickIntent(File f) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE, null);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
return intent;
} */
// 请求Gallery程序
protected void doPickPhotoFromGallery() {
try {
final Intent intent = getPhotoPickIntent();
startActivityForResult(intent, PHOTO_PICKED_WITH_DATA);
} catch (ActivityNotFoundException e) {
Toast.makeText(this,"2f3upi",Toast.LENGTH_LONG).show();
}
}

// 封装请求Gallery的intent
public static Intent getPhotoPickIntent() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
intent.setType("image/*");
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", 80);
intent.putExtra("outputY", 80);
intent.putExtra("return-data", true);
return intent;
}
protected void doCropPhoto(File f) {
try {
final Intent intent = getCropImageIntent(Uri.fromFile(f));
startActivityForResult(intent, PHOTO_PICKED_WITH_DATA);
} catch (Exception e) {
Toast.makeText(this, "111111111111111",Toast.LENGTH_LONG).show();
}
} public static Intent getCropImageIntent(Uri photoUri) {
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(photoUri, "image/*");
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", 80);
intent.putExtra("outputY", 80);
intent.putExtra("return-data", true);
return intent;
}

/**
*
* Bitmap picture = Bitmap.createBitmap( 480, 480, Config.ARGB_8888 ); //创建一张480*480大小的图片
Canvas canvasTemp = new Canvas( picture ); //创建画布
canvasTemp.drawColor(Color.TRANSPARENT); //设置画布透明
Paint p = new Paint();

smallpic=Bitmap.createBitmap(bigpic, 0, (count-1)*width, width, width); //从大图片中取得第count张图片,从上往下数
canvasTemp.drawBitmap(smallpic, 0, 0, p); //将取得小图片画在画布上,位置(0,0)
*
* */

更多相关文章

  1. Android(安卓)封装http请求的工具类
  2. Android(安卓)Service系列(十)直接继承Service
  3. 教你如何绘制圆形头像
  4. android之setBackgroundDrawable()
  5. JAVA-ANDROID
  6. Android(安卓)GifImageView加载Gif图片及原理
  7. 在Android工程中,添加ICON资源
  8. Android(安卓)Webview 部分图片显示不出来问题
  9. Android使用SVG的一点小坑

随机推荐

  1. android 常见死机问题-如何分析
  2. Android(安卓)初体验
  3. android所有需要的Demo地址
  4. 【Android基础】Activity的启动模式(andr
  5. 解决Intellij idea运行android applicati
  6. Android游戏引擎《Rokon》学习笔记六:一个
  7. Android(安卓)网络框架初探
  8. Android(安卓)OpenGLES绘制yuv420纹理
  9. Android(安卓)HandlerThread源码解析
  10. android proguard混淆apk问题