2017년 8월 22일 화요일

you can take a photo from app inventor how to return and have the name of the ph


you can take a photo from app inventor how to return and have the name of the photo to open it later if necessary? I know how to start the camera but then you have to take the picture manually while I would like to know if you can shoot without opening the camera. Thank you.

--
This inability to capture the name of a photo  is a SERIOUS limitation in AI2.     There is no Camera.SaveImageAs.    Your photo, is saved using an arbitrary number.jpg image in the Downloads folder.

With a Canvas, you can .   call Canvas.SaveAs                      fileName              
and assign a specific name.   You can not do that with Camera.


To complicate matters, AI2 has no way to view the contents of a folder.   The File component is a nice tool, but it does not provide anyway to list the contents of a folder to  show 
what files exist.  Therefore you can not specifically use this control to  delete a file unless the name of the file is saved somewhere within your app (or you remember the name).

So, you cannot use the File component to manipulate the photos you take with Camera, that is you can not retrieve them or delete them without using a file manipulation app or using the app on your device to view photos and view/delete from the images posted in that app.
.
With Canvas, you can find out the name of the file that is being saved if you grab it from a web page (Web.GotFile    and filename  will do that) but there appears to be no 
way with stuff stored on your Android device using native AI2.     

It might be possible to do find all the files in a folder using javascript.

Perhaps somone is aware of something I missed?    Please post here. :)

Also, be aware, there are several bugs in the AI2 camera component.  Please read about that here:   https://groups.google.com/forum/#!searchin/app-inventor-open-source-dev/camera/app-inventor-open-source-dev/jDu24R3584M/qwGobn6umNgJ

--
 while I would like to know if you can shoot without opening the camera.

--
Here are some hints as to creating your own javascript  that may allow you to take photos with AI2:





and LOTs of others.  Sorry, these are not Blocks.... but with your imagination and some effort, they could be.

--
it would be nice, but 
1. you will not be able to access the camera from within the webviewer and some HTML/JavaScript
2. you also will not be able to access the file system
the webviewer is no full browser and only a few HTML5 concepts will work



--
how to return and have the name of the photo to open it later if necessary? 
you get the path of the taken photo in the Camera1.AfterPicture event, just store that in TinyDB to be able to view the photo later

--
but I do not want to have to press another button to take the picture I want to take the picture by clicking on the button of my app in app inventor make myself clear?

--
Yes, I understand your question, some others here do not. Both you and I expect others to read our posts carefully and are grateful when one answers the parts of queries they are capable of answering.   It is a courtesy but not so when other parts of the comments are ignored.

In my opinion, the AI2 Camera tool is a basket case.  

The only way to  " press another button to take the picture I want to take the picture by clicking on the button of my app in app inventor" at present would be to use a java script, it that is even possible.
Taifun's solutions do NOT answer your questions about these tools or mine.   Using the TinyDB as a way to store the images for retrieval i awkward and provides little flexibility   You can use the method he proposes or use a different compiler (as I do when AI2  does not yet have a required feature).

At the moment, without a lot of coding by you or the MIT development team, what you want AI2 to do is not possible with the existing controls.  AI2 is NOT a professional compiler.  It was never intended to be one.  It has a very small development team and it provides an excellent training tool for coding and helping people use their imagination to develop ideas.  It gets 5 stars for that.  For other things,
it can do a reasonable job of allowing one to develop an app whether otherwise it would be impossible because of lack of programming skills or simple tools to do so.

If you have to code an app to do what you want, you must  either learn to program in Java using Eclipse or Android Studio.  Both are free of charge compilers. Alternatively there are other compiling tools that do not use Java..a difficult language to code in.  A very inexpensive compiler that most AI2 users can easily 'graduate' to is one called Basic4Android.   B4A uses a language very similar to the Visual Basic language used in Windows but it is used to create Android apps.   You can do exactly what you want to do in Basic4Android.  I have seen a beautiful app coded by a friend that does just that, it takes a picture by just pressing  a button in the app.   No intermediate steps.

You can help to provide the capabilities you want to AI2.  AI2 is open source.  That means you can provide and make tools for Ai2  or improve tools if you are an experienced coder.  Visit here:    http://appinventor.mit.edu/appinventor-sources/      to find out more    and r visit the forum devoted to improving AI2 and its tool box here:   https://groups.google.com/forum/#!forum/app-inventor-open-source-dev

--
but I do not want to have to press another button to take the picture I want to take the picture by clicking on the button of my app in app inventor make myself clear?
With the App Inventor built-in camera component it is currently not possible to take pictures programmatically without user intervention, see also issue 323.

I now created the Java app Take Picture as workaround for issue 323. You can start it from within App Inventor with the Activity Starter to take a picture (without shutter sound) programmatically. The path to the image will be provided in the ActivityStarter.AfterActivity event back to App Inventor. 

--
Could you write up exactly how the camera component should behave and I can try to find someone to work on it.  Thanks.

You might also have a look at the Camera.java in the sources.  You'll see there's not much there.

--
I will do that.    I will also comment on issues related to not being able to capture the contents of folders with File etc.   You can not delete unless you know the names of the files nor can you load images saved by Canvas and/or Camera ... without resorting to TinyDB, lists and other convoluted procedures.   Nice tools, but not fully fleshed out.

--

댓글 없음:

댓글 쓰기