我将图像保存在android / data / com.myappliction / files / Pictures / file.jpg的文件夹中。 每当我尝试使用滑行打开时。 我得到以下日志。
码:
public class profile extends AppCompatActivity {
ImageView imageView;
File file = new File("Android/data/com.example.cogniace/files/Pictures/profile.jpg");
private static final String TAG = profile.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
imageView = findViewById(R.id.imageView);
Glide.with(this)
.load(file)
.placeholder(R.drawable.ic_sync_black_24dp)
//.error(R.drawable.camera_icon)
.into(imageView);
例外:
2019-10-22 16:40:05.337 30115-30115/com.example.cogniace W/Glide: Load failed for Android/data/com.example.cogniace/files/Pictures/profile.jpg with size [1002x1506]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 3 causes:
java.io.IOException(File unsuitable for memory mapping)
java.io.FileNotFoundException(Android/data/com.example.cogniace/files/Pictures/profile.jpg (No such file or directory))
java.io.FileNotFoundException(open failed: ENOENT (No such file or directory))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.nio.ByteBuffer, LOCA