Android 在下一个活动中发送图像字符串,并使用AQuery加载图像
最初我使用位图来处理图像事件Android 在下一个活动中发送图像字符串,并使用AQuery加载图像,android,image,image-processing,aquery,Android,Image,Image Processing,Aquery,最初我使用位图来处理图像事件 我可以将位图传递给活动,也可以加载图像 但当我测试时,我发现一些设备位图崩溃 我所做的 --对于图像选择和传递: private void selectImage() { final CharSequence[] items = {"Choose from Library"}; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Add
private void selectImage() {
final CharSequence[] items = {"Choose from Library"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Add Photo!");
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
/*if (items[item].equals("Take Photo")) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, IntentConst.REQUEST_CAMERA);
} else*/
if (items[item].equals("Choose from Library")) {
Intent intent = new Intent(
Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
startActivityForResult(
Intent.createChooser(intent, "Select File"),
IntentConst.SELECT_FILE);
}
}
});
builder.show();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == this.RESULT_OK) {
if (requestCode == IntentConst.SELECT_FILE) {
Uri selectedImageUri = data.getData();
String[] projection = {MediaStore.MediaColumns.DATA};
Cursor cursor = this.managedQuery(selectedImageUri,
projection, null, null, null);
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
cursor.moveToFirst();
selectedImagePath = cursor.getString(column_index);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(selectedImagePath, options);
final int REQUIRED_SIZE = 200;
int scale = 1;
while (options.outWidth / scale / 2 >= REQUIRED_SIZE
&& options.outHeight / scale / 2 >= REQUIRED_SIZE)
scale *= 2;
options.inSampleSize = scale;
options.inJustDecodeBounds = false;
setimg = BitmapFactory.decodeFile(selectedImagePath, options);
Log.e("image path",selectedImagePath);
ivProImage.setImageBitmap(setimg);
}
if (requestCode == RESULT_SEND) {
Intent intent = new Intent(getApplicationContext(), ActivityCardLogo1.class);
startActivity(intent);
}
}
}
--我想要的是,将图像字符串发送到下一个活动,并使用AQuery加载图像通过intent中的putExtra方法将其作为base64字符串发送;在下一个activitycan u show演示plz.1中加载相同的图像。浏览如何将图像转换为base64;2.如何使用意图将传递字符串发送到另一个活动3。从有帮助的意图活动中获取字符串;也;4.如何使用base64字符串获取图像的位图;这样你就可以在图像视图上设置它了;如果应用程序崩溃,则无法加载图像;u始终可以使用位图工厂的采样功能