4
4
4ainik2017-03-15 19:49:30
Android
4ainik, 2017-03-15 19:49:30

Why doesn't loading an image from a file work?

Here is the code:


Bitmap result = BitmapFactory.decodeFile("/data/data/com.lizaalert/cache/14350.jpg");
if(result == null){
Log.e(MainActivity.TAG, "onPostExecute::BitmapFactory Bitmap result == null" );
}
ImageView iv = (ImageView) findViewById(R.id.imageView1);
iv.setImageBitmap(result);

which is registered in the OnCreate activity, just for checking.
and although the file exists but BitmapFactory.decodeFile returns null.
What could be the problem?
In general, the task is the following: download the image file by url and save it to the local cache. Actually, this file is the cached image...
There are no exceptions...
Some kind of devilry :)
Maybe BitmapFactory works exclusively with bitmap (bmp) ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question