我创建了一个将图像保存在Android Gallery中的应用。但是,这确实会将文件移动到DCIM
文件夹中,“图库”不会显示该图片。
这是我的代码:
from kivy.app import App
from kivy.uix.button import Button
from kivy.core.image import Image
from android.permissions import request_permissions, Permission
from os import *
class SITApp(App):
def build(self):
request_permissions([Permission.WRITE_EXTERNAL_STORAGE])
return Button(text='Save Image', on_press=self.save)
def save(self, button):
try:
mkdir('/sdcard/DCIM/Image Saving/')
Image('test.png').save('/sdcard/DCIM/Image Saving/test.jpg')
except Exception as e:
button.text = str(e)
SITApp().run()
如果有人可以帮助我,将不胜感激!