Android: Saving Picture to a File and Retrieving it

前端 未结 2 576
太阳男子
太阳男子 2020-12-18 15:19

After taking a picture with my camera, I want to save it in that layout. I also want to save it to a File and be able to load that picture when I create the activity(so if i

相关标签:
2条回答
  • 2020-12-18 15:52

    It sounds like your code works, but you are losing your image when the activity comes back. Loading your picture onPostResume() instead of onCreate() may be what you need. It feels like the activity lifecycle is the key to your problem. I have a couple of questions I will throw into comments.

    0 讨论(0)
  • 2020-12-18 15:56
    out = ctx.openFileOutput(filename, Context.MODE_PRIVATE);
    

    Try switching to:

    out = ctx.openFileOutput(filename, Context.MODE_WORLD_READABLE);
    
    0 讨论(0)
提交回复
热议问题