How to read image file stored in internal memory?

前端 未结 1 1594
死守一世寂寞
死守一世寂寞 2021-01-05 10:25

In my android application I an storing an image file in internal memory using below code-

FileOutputStream fos = con.openFileOutput(fileName, con.MODE_PRIVAT         


        
1条回答
  •  不思量自难忘°
    2021-01-05 10:52

    Try this:

    ImageView imageView = (ImageView) findViewById(R.id.image);
    File filePath = getFileStreamPath(fileName);
    imageView.setImageDrawable(Drawable.createFromPath(filePath.toString()));
    

    In the above snippet R.id.image is id of ImageView somewhere in your layout. fileName is a String containing name of the file you used in openFileOutput call.

    0 讨论(0)
提交回复
热议问题