问题描述
CameraDevice.createCaptureSession 大多已弃用。任何关于如何将剩余版本方法与 SessionConfiguration 参数(尤其是 executor 参数)一起使用的示例都会很好。
目前我有:
import csv
name = input("register your name: ")
name=name.replace(" ","")
with open("datafile.csv","r") as file:
content=file.read()
loop=True
while loop!=False:
if name in content :
name = input("name taken pls try again: ")
name=name.replace(" ","")
else:
loop=False
password=input("new password: ")
with open("datafile.csv","a+",newline="") as file:
f=csv.writer(file)
f.writerow([name,password])
def main():
with open("datafile.csv","r") as file:
file_reader = csv.reader(file)
user_find(file_reader)
file.close()
def user_find(file):
user = input("Enter your username: ")
for row in file:
if row[0] == user:
print("username found",user)
user_found = [row[0],row[1]]
pass_check(user_found)
break
else:
print("not found")
def pass_check(user_found):
user = input("enter your password: ")
if user_found[1] == user:
print("password match")
else:
print("password not match")
main()
解决方法
如果您不想使用任何执行程序功能,您可以使用 HandlerExecutor:
SessionConfiguration sessionConfiguration = new SessionConfiguration(SessionConfiguration.SESSION_REGULAR,Collections.singletonList(outputConfiguration),new HandlerExecutor(mCameraHandler.getLooper()),mCameraSessionListener);
cameraDevice.createCaptureSession(sessionConfiguration);