标签:style blog io ar color os sp for on
/** * 照片对话框 *AlertDialog */ private void PhotoDialog() { AlertDialog.Builder builder = new Builder(mContext); // mContext上下文 builder.setTitle("上传照片至开心网"); builder.setItems(new String[] { "拍照上传", "上传手机中的照片" }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = null; switch (which) { case 0: //点击是拍照上传 intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File dir = new File("/sdcard/KaiXin/Camera/"); if (!dir.exists()) { // 不存在 dir.mkdirs(); } mKXApplication.mUploadPhotoPath = "/sdcard/KaiXin/Camera/" + UUID.randomUUID().toString(); //保存图片到sd卡的名字 File file = new File(mKXApplication.mUploadPhotoPath); if (!file.exists()) { // 不存在 try { file.createNewFile(); } catch (IOException e) { } } intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); mActivity.startActivityForResult( intent, ActivityForResultUtil.REQUESTCODE_UPLOADPHOTO_CAMERA); break; case 1: //上传手机中的照片 mContext.startActivity(new Intent(mContext, PhoneAlbumActivity.class)); break; } } }); builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); // 取消 } }); builder.create().show(); }
标签:style blog io ar color os sp for on
原文地址:http://www.cnblogs.com/java-g/p/4129634.html