したがって、私が何をしても、picassoとglideのどちらも、画像ファイルまたは画像文字列パスを画像ビューにロードできません。
私はもう試した。
ここに私のコードがあります:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data)
{
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};//Array size of 1, and we put in a string
Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
user_image_path = cursor.getString(columnIndex);//here we have our image path.
cursor.close();
File tempFile2 = new File(selectedImage.getPath());
//Toast.makeText(this, "I got your image " + user_image_path, Toast.LENGTH_SHORT).show();
myImageView = (ImageView) findViewById(R.id.cameraActivity_ImageView);
//Picasso.with(TakePhotoActivity.this).load(selectedImage).fit().centerCrop().into(myImageView);
Glide.with(this).load(new File(selectedImage.getPath())).centerCrop().into(myImageView);
}
}
だから私は試しました:
1)Picasso.with(TakePhotoActivity.this).load(user_image_path).fit().centerCrop().into(myImageView);
2)Glide.with(this).load(user_image_path).centerCrop().into(myImageView);
3)Picasso.with(TakePhotoActivity.this).load(tempFile2).fit().centerCrop().into(myImageView);
4)Glide.with(this).load(tempFile2).centerCrop().into(myImageView);
5)Picasso.with(TakePhotoActivity.this).load(selectedImage.getPath())).fit().centerCrop().into(myImageView);
6)Glide.with(this).load(selectedImage.getPath())).centerCrop().into(myImageView);
それらのどれも機能しませんでした。私が使用する場合:
Picasso.with(TakePhotoActivity.this).load(selectedImage).fit().centerCrop().into(myImageView);
Glide.with(this).load(selectedImage).centerCrop().into(myImageView);
上記の 2 つは Uri selectedImage 変数で機能しますが、他のものは機能しません。理想的には画像パス文字列を操作したいので、他のオプションが機能しない理由とそれらを機能させるにはどうすればよいですか。
皆さんが助けてくれることを願っています! 私はこれに完全に困惑しています。