2017년 4월 18일 화요일

Saving files and overwriting doesn't work


When I use the extension "Taifunfile" I got some problems with it.

Description:
I save a canvas backround to a file (QRCodeTmp.jpg). =>OK
Now I share this file. => OK
Now I save a new canvas background to the same filename as before (QRCodeTmp.jpg). (with a file explorer I see the new picture.)
But when I now share this file again, everytime and only the first picture can be shared. It also doesn't work when I first delete the file and then create a new one with the same filename.

Somehow App Inventor stores the once saved file in a cache or so.

When I close an reopen AppInvetor again, everytime the first picture can be shared.

Perhaps you can have a look to my code...

Also when I try to use the "when.TaifunFile1.Moved" and simply add a notifier, nothing happens. The notifier is not called.

--

When I use the extension "Taifunfile" I got some problems with it.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

-- 
Sorry I don't get you. The relevant blocks are listetd in my screenshot I attached... ?

-- 
you said, you have issues with the TaifunFile extension, but you do not use any blocks from that extension...

-- 
Yes, I also tried this block:


File copy works, but only when I open a file explorer I see that the picture has changed.
When I share it, it's everytime the first picture I saved when starting the app.
When I rerun this routine I never get the actual save picture to share.
Perhaps it's an app iventor problem?

-- 
which means, you do not have an issue with the file extension, you have an issue with saving a canvas and using the Sharing component

Please prepare an example as small as possible, which demonstrates this issue and add the project (aia file) into this thread together with exact instructions for how to elicit the error, so someone can take a look

-- 
here is an example.

Description
Only the first picture is shared. 
If you change the picture it's shown in the canvas but it's ignored for sharing...


--
works fine for mes using Gmail to share on Necus 5X running Android 7.1.2

which app do you choose to share? which device / Android version?
did you try Gmail to share? did you try another device / Android version?

-- 
I tried it with whatsapp

1. I tried it on device  "samsung S7" (model SM-G930F9, android version 6.01
2. I tried it on device "sony xperia 2" (model  D5503), android version 5.1.1

I didn't try it with gmail until now, because that's not what I wnated.

-- 
I now tried Whatsapp and can confirm your issue... which means, this seems to be a Whatsapp issue ...
you might want to try Gmail as test and let us know, if Gmail works for you...

-- 
Ok, with gmail it works but not with whatsapp...

So, any idea? (I need whatsapp) to share.

-- 
see here http://stackoverflow.com/a/30541618/1545993 and use different filenames...
see working version attached
Taifun
PS: btw. it would be possible to write an extension, which is able to open Whatsapp directly without app chooser dialog... 

-- 
OK I'll use different file names to share.
That's what I did before, too. But I found it a bit uncomfortable.

Thanks for your help.

I got another problem with sharing from App Inventor but I post it as separate question.

-- 

Taifun's JavaScript Injections


Situation: I have been playing with Taifun's "How to fill out a form of a webpage and click a button using some JavaScript" article code.  It's really awesome!

Problem: But I can't get the app to fill out my form when the CurrentPageTitle equals the title of the page I'm sending the web viewer to.

What I think is the cause of the problem: When I have a notif alert me when the CurrentPageTitle equals the title of the page I'm sending the web viewer to, I am alerted before I see the form in the webviewer.  So I think that is the problem, that the form isn't loaded completely when the form is filled out and submitted.  Or even is it filled out and submitted at all since it hasn't loaded yet?  So my question is: How do I know when a web page is fully loaded and ready to have its form filled out?P.S. Note to fellow coders who couldn't figure out how to make a Spreadsheet send an email: Make a form that sends the email and have your app fill out the form.  This works for me, except I haven't quite figured out the above problem.




--
How do I know when a web page is fully loaded and ready to have its form filled out?

as soon as the correct page title is returned
so what about removing the not block as shown in the tutorial https://puravidaapps.com/inject.php?

-- 
I just tried that (see screenshot).  The form fields weren't filled in, the button wasn't clicked.  It works when I have the user click a button once the page loads.  But that's user-dependent.


-- 
how did you set the timer interval? try a larger timer interval or after the correct page title is returned, then wait a little bit before injecting the values
Please Wait method by Scott

-- 
Oh no!  I accidentally clicked the unsubscribe link!

I thought of that solution myself.  What if someone's on a very slow device, though, and my interval isn't enough?  I'll do it, but...

--
Sorry, 100.
--
this is too fast imho, try 1000

-- 
I tried with 1000, but that didn't fix it.  Wait 1 worked, believe it or not.  And then I tried without the wait again (still using 1000) and it worked.  I'm using a different (slower) computer with it, but it didn't do that before.  Weird.  Thanks for your help!

--


List View Problem ( Please Help!!! )


I want to link " List view "  text list

each name to  make a phone call

I don't know how to do that .Is it possible?

I want to create with list view a phone list with names and when you press it to make calls.

Fro example John - 100 , Mary 200 etc...

Can someone help me please?

--
Yes, you can do something with a listview like that.  What have you tried?



Do you know how to use a ListView to do other things?   To use it to make phone calls will be very similar.    You can use two lists, one with the names, the second with the numbers in the same order they are in the name list.  Set the ListView to show the name list and in the ListView.AfterPicking block place the code to select the corresponding item in the number list and use that to make the phone call.

-- 
I'm completely newbie in coding, im only good at designing, this is the reason i like appinventor, i like its visual style.

The only thing i did and know is to create list with names :

" when a button is clicked - set list view to - make a list  - "text here" "


"You can use two lists, one with the names, the second with the numbers in the same order they are in the name list."


I don't understand exactly your example, is there an example?


"Set the ListView to show the name list and in the ListView"


Its the only thing i did, i created a " list view" with the names i want , tested to my phone and successfully works!!! 


"Set the ListView to show the name list and in the ListView.AfterPicking block place the code to select the corresponding item in the number list and use that to make the phone call."


How can i do that? This is my problem, i want to connect each list block to do functions not only calls but to link to web pages.

You need to Know java to do some advance functions in appinventor?, in appinventor help only shows blocks explanation not the combination of commands or what you need to do some apps ( correct me if im wrong)

-- 
You started experimenting and found out a lot.

Here is a basic app doing what you described:
You " want to connect each list block to do functions not only calls but to link to web pages."    Yes, you can do that, instead of or in addition to the phone blocks you can use either a WebViewer or an ActivityStarter to point to a Web page.
⦁ Using the Activity Starter
Open the browser to a designated Web page
Use these ActivityStarter with the VIEW action and a DataUri  to open the phone’s browser to a designated web page, for example,
Action: android.intent.action.VIEW
DataUri: http://mit.edu

Using a WebViewer: put the component on your Designer screen;  use the following block...   call WebViewer.GoToURL and place a Text box in the puzzle piece like    http://mit.edu  to link to the Web page.

either will work but use different techniques.

I recommend you do some of the tutorials and read the Inventor's Manual .. doing so will help you program.

We want you to have fun with App Inventor and learn to program.  Here are some resources to help you learn to use the AI2 tools  A very good way to learn AppInventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  

How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Still having a problem, post some blocks and someone probably can provide specific advice.

-- 
I really appreciate your time to help me Steve.

But I have some questions , to realize whats going on with the blocks diagram:

( "call PhoneCall1.MakePhoneCall")

Do i need " phone call " component, not for add a phone number to it, but to add its functions to the blocks? 
Appinventor understands this command  "call PhoneCall1.MakePhoneCall" , so it can add call function to the list?

"set global name list"  "    " Initialize global name list"

Whats is their meaning - use to the blocks code, and whats their differences?, if there are...

"set screen1 title to Phone Call1 Phonenumber "

This 2 blocks use is to show at the title of the screen the title we want to write ?

What blocks make the appinventor to "understand" that we want to combine list names with numbers?

Is there a book that explains the code blocks not separate like the help manual , but the combination like my example i asked you, or a deep analysis of what its block do?, how do you now that this blocks required ?, i mean you know programming ? you know Java? Do i need to learn Java? 

or through examples step by step through experience you learn like my example? Iam really confused about what are the requirement of learning to code in appinventor.

-- 
You need to read  the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks. We already told you what the phone blocks do (   http://ai2.appinventor.mit.edu/reference/components/social.html#PhoneCall    )..  If you do not understand that explanation you need to probably take the free course mentioned here.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  

How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .


Perhaps you need to put away this Project for the moment.  Read the free ebook, do some tutorials and learn how to program with App Inventor Blocks.  You do not need to learn Java to program with App Inventor but if you want to be a professional programmer, you will probably need to learn Java.

-- 
Thank a lot Steve!!

you help me a lot.

I made it!!!

I create the lists like you said!!! 

The block diagram helps me!!! ( i take a part of it )

I understand by myself some functions but, i need a  lot of practice to understand deeper in programming.

I will read the books and tutorials you linked.

SUPER!!!!!

Thanks a lot.!!!!

-- 

Canvas/ImageSprite Grid inside an Arrangement with Resizing!


Following on from this topic I raised a while ago: 

I have realised the fruits of my labours and now present a sample app on the Gallery: 

Of special interest is the use of a single canvas with a single imagesprite image set out in a grid, within a vertical arrangement. By clicking on part of an image, co-ordinates are returned, converted to a number, then the canvas,image and vertical arrangement are resized to show just that one image. I am somewhat at the behest of the quality of many of the original images, will work on improving this for the future. Text to Speech recogniser used to speak the image. It doesn't have to be any more complicated that this for our students, in fact for some it can be a bit of a stretch having to choose from so many options!


--
Tim, you didn't share the Gallery url.



How to get it:








-- 
I tried it. Unfortunately you are using absolute dimensions on your canvas (pixels) instead of relative (percentage) The canvas in my phone looks too big and is mostly out of the screen.
When I touched the canvas, the app force closed.
I suggest you to use relative sizing instead, so it will show the right way in any device.

-- 
If you would like to run it in any device, you can use FILL PARENT on width and height.
Then knowing how many squares your image has, you can determine which square was touched by dividing the canvas and height, that will give you a set of coordinates.
Just an idea.

--
Sorry Tim, this interesting app crashes my Samsung Tab II ... whenever I 
1) attempt to change the volume with the tablet's hard keys
2) immediately after selecting an icon..it speaks then crashes..indicating Companion has stopped.

This is using Companion.  I expected to get a different result on compiling but no it still has issues.

-- 
Thanks for trying it out. Wasn't meant to cause all these problems!

Quite possibly timing issues between devices,as you will see I have had to add clocks to allow the arrangement, the canvas and the image time to reshape themselves.

This app runs faultlessly on my Google Nexus 7 2013 (what it was designed for).

Have been working on a responsive sizing but this just seems to introduce more timing issues, and the co-ordinates are not coming through correctly, not sure why? All sizes are based upon the screen width. Testing on my Nexus 7 emulator where I know the screen width is 960 (well 961 actually), should render things the same as the fixed size app, which it appears to, but the co-ordinates are returning the wrong tile number. Seems somewhere along the line the tile size is being rotated (instead of 100 w x 125 h it swaps to 125 h x 100 w !!). The x/y number procedure is working correctly, something to do with the canvas....  I'll have a bit more of a play. 

-- 
I hope this can help:
I simplified your coding a little bit by using a list of lists.
Then calculation that returns which column was touched depending on the canvas width and the amount of columns your picture has.
I duplicated that formula to do the same vertically.
Also I used the canvas to detect the touch without needing a sprite.
Then you can make the TextToSpeech component to say what's in the top label. It works in my phone, but I can't use TextToSpeech in my emulator to show it here.

Please watch the video:

-- 
That video didn't look so good. Let's see if this one is better.

-- 
Got my responsive version working on my tablet and my phone (HTC One M8s) through the Companion. Might still be a bit crashy, but how many timers can I put in?

Possible it won't pick up the screen orientation on first run ?

Images look worse on the phone ;)

Give it a go.

--