Android-SmartWebView icon indicating copy to clipboard operation
Android-SmartWebView copied to clipboard

The camera cannot be used Find the error code

Open lip5201 opened this issue 3 years ago • 2 comments

      It has been tested that there is a problem with the broken code here. Can you fix it?

After deleting this code, I can call up the camera, but I can’t upload pictures after taking pictures.

                                    paramCheck:
						for (String acceptTypes : fileChooserParams.getAcceptTypes()) {
							// Although it's an array, it still seems to be the whole value. 
							// Split it out into chunks so that we can detect multiple values.
							String[] splitTypes = acceptTypes.split(", ?+");
							for (String acceptType : splitTypes) {
								switch (acceptType) {
									case "*/*":
										includePhoto = true;
										includeVideo = true;
										break paramCheck;
									case "image/*":
										includePhoto = true;
										break;
									case "video/*":
										includeVideo = true;
										break;
								}
							}
						}

lip5201 avatar Sep 04 '20 14:09 lip5201

It's not about the code that's broken, this particular problem is happening across different devices no matter the SDK or Android variant. Instead, this is the only snipped I got to work across majority of devices.

But we're trying dude. This bug is messy.

mgks avatar Sep 04 '20 15:09 mgks

The project is great!

The problem has been solved, there is no problem calling the camera code! The great reason is that type="file" gets the empty type, which affects the code judgment

I added the default value judgment at the end

                                       default:
                                       includePhoto = true;									
                                       break;	

switch (acceptType) { case "/": includePhoto = true; includeVideo = true; break paramCheck; case "image/": includePhoto = true; break; case "video/": includeVideo = true; break; default: includePhoto = true; break; } }

lip5201 avatar Sep 04 '20 18:09 lip5201