2016년 11월 22일 화요일

Problems with multi-screen app


When I compile the app and change the screen gives me error, why? thanks to those who respond

-- 
What error do you get?
Do you have exact case-sensitive screen name?


--

The recommended method of switching screens in App Inventor
Taifun

-- 

How to i convert IP address to bit binery on app inventor2?


Hi all,

This is the first time i am creating application and i was told by my lecturer to create a IP converter. i have no idea how to make the IP address and subnet appear on the text-box and i also need to convert subnet mask to bit binery as well for my project. Hope i would be able to get help from you all. I have attached a png file to show you guys know roughly how it look like

-- 

 i have no idea how to make the IP address and subnet appear on the text-box

my WiFi extension https://puravidaapps.com/wifi.php can provide to local IP address


 i also need to convert subnet mask to bit binery as well for my project
how would you do that manually?

A very good way to learn App Inventor 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  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

Taifun     


-- 
You can see examples of base conversion in parts of this Gallery app:

ABG


-- 
Why doesn't my procedure have extra 'call' block compare to the link you gave me? i have attached the screenshot please take a look. Thanks

ggg.png 표시 중

ggggg.png 표시 중

-- 
You have to create the procedure and add parameters to it via the blue box before you can find it in the Procedures blocks section.

Pull a blank value procedure onto the Blocks area, then rename it and add parameters.
(Defining Procedures).

ABG


-- 

Request Headers


How do I request headers?
How do I request headers?

I'd like a response from this. 

Host: dev.tescolabs.com
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

Thanks very much

-- 

see here https://puravidaapps.com/dropbox.php for an example of how to set the headers 
Taifun


-- 
I don't think I'm too far off with this, just need some help to get the blocks right please.

request.png 표시 중

blocks.png 표시 중



response.png 표시 중


-- 
remove the : (colons) in the request header...

in case this still does not work, then try to add in the header 
Content-Type
text/html

Taifun

-- 
Thanks Taifun, worked a treat


-- 

Download Dropbox Tan file with App Inventor


I want to download the Dropbox Tan file with the appinventor.
How can I do it?

-- 
what is a Tan file?
see the Dropbox upload example https://puravidaapps.com/dropbox.php and adjust it to your needs following the Dropbox API documentation

Taifun

-- 

I want to download the Dropbox file with the appinventor.
How can I do it?


-- 

Screen widths and heights


Has anybody else had issued with the screen height and widths being back to front?

When changing the screen orientation I've noticed the screen.height and screen.width values appear to be back to front. I'm not sure if it's an issue in my code, my phone or the appinventor code. 


Attached is a sample code. I would have thought that that would mean that 
If landscape - make the canvas height the screen size and the width a ratio of height
else portrait - make canvas width of screen and height a ratio of width 

I've also got a different title for portrait and landscape so I know when it's in portrait mode and landscape mode. For some reason it selects the portrait title when it's in landscape mode and vice versa and all my canvas sizes, appart from the initial load are messed up.

-- 
I think, this is a timing issue
after changing the orientation, try to call that procedure some milliseconds later to get the correct values
you can use a clock component for that
Taifun

-- 
Great that was it. Just had to add a timer. Thanks!

-- 

Font Size Override in Settings


Hello,

I have noticed in the Android OS, you can changed the font size in the Android OS settings from tiny to Huge and many steps between. When you do this Android warns you that it may not be applied across all Apps. The problem is, it is applied across my App and it causes text to become too big for the labels. Is there a way to lock the text to the chosen font size in App Inventor so that Android OS cannot override it?

Thanks,
Jonathan

-- 
Did you try checking the Screen1 setting RESPONSIVE?

-- 
I'll try it.


-- 
I haven't tried it yet, but the now that I am remembering, the reason I have it set to fixed, is that if I set it to responsive if I switch a background image it becomes  blurry and pixelated. MIT App Inventor may have fixed it, I will see.

-- 
I tried it, It may help on the font, I do not know, but I will not be able to use it on my App, because it makes my background images become pixelated. I think it is a bug in MIT App Inventor.

Thanks,

Jonathan

-- 
Make the image bigger?

-- 

Bigger then 1080x1920 pixels?


-- 
Why do some images get pixelated?    

Images become pixelated when one attempts to stuff a low resolution image into a large space; for example stuffing a 50x50 image into a 1080x1920 screen.

Android Studio and Eclipse users avoid this by using s suite of different size images to display on different size device screens.  See perhaps  http://stackoverflow.com/questions/31506472/imageview-images-seem-pixelated-and-low-quality

AI2 users can minimize this by using png images instead of jpg images ... they are more easily up-converted on Android devices. The larger the size an original image has to be up-converted, the more pixelation.

Your possible solution is to provide a png image instead of jpg (if you use jpg)  or provide a larger image size  for your background...the size does NOT have to be 1080x1920 ...experiment.

You did not mention what size your original images are and whether they are jpg or png.  The algorithm Android devices use to up-convert work better but not perfectly with png images.  Realize, your device cannot provide a sharp image if the image provided is up converted by a lot.


-- 
Aside from the great advice from SteveJG's, I need to add something.
You say you are trying to use an image as background while also talking about font sizes. Is that really a good looking layout? Can you do it without an image and maybe use a subtle texture, a gradient or a plain color? I know is not what you asked for, but as a graphics designer and a person who has seen so many poorly thought layouts, please consider not using a complex image as a background when you have text in front of it. It doesn't help legibility/contrast and it doesn't look professional at all.


-- 

webviewer not showing fusion table data - PizzaApp


Hi
my webviewer does not display the fusiontable.
Question relates to the PizzaTutorial and the PizzaApp.
1) I followed the instructions in the tutorial, used the template .aia file. Filled in the relevant .url .p12 and service account --> App works but no data displayed.
2) Then used Mark Spieglan's video tutorial https://www.youtube.com/watch?v=14jyD7_V1RA. checked the data again --> App works but no data displayed

I can:
- add records to the fusiontable thru the emulator, google drive, and my phone after downloading the .apk
- display the records on google drive, on the phone and PC
- display correctly any internet address codeing the address into the app inventor2 designer or the blocks variable e.g. http://www.google.com
I can't
- display any fusiontable record thru the webviewer on emulator or phone -after loading the .apk

any ideas what to do next?



-- 
did you test using the companion app or after building the app?
sometimes you have to wait a few seconds until the table is displayed
also do not use the emulator to test this! 


Taifun

-- 
Hello Taifun
webviewer did not work yesterday nor today;-)
I've tested with AI companion, emulator and downloading onto my phone, before and after: always same result.
I did search the web: it seems that it works for some but not all users.
see: the already mentioned youtube tutorial --> only displays one line then stops. ... comment with same Problem.
see: your thread with
 Surendra Kapadia: same problem description --> not sure if he got it working.

I'll keep on reading and trying
werner

-- 
1. use your device to test instead of the emulator
2. make sure to set the webviewer height to fill parent

and in case this does not help
try the Webviewer.ClearCaches and the Webviewer.GoHome methods

also to consider: The fusiontable will be updated immediately, but the webviewer displays the published table. Google needs normally a few seconds to refresh the published table, therefore be patient to view the updated result in the webviewer
If you like to view the result immediately, use a SELECT statement to query your table and display it in App Inventor...

Taifun

-- 
Hi
I did test with other phones and Android Versions
webview displaying fusiontable did work on
Android 4.4.2 - HTC One
Android 5.1.1 - Mi Redmi 3

webview did NOT display fusiontable at all - but www. addresses work fine
Android 4.2.2 - Huawei Y330

werner

-- 
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


Taifun

-- 

мне нужна ваша помощь при работе со списком (I need your assistance in working with a list)


имеется список папок. например : 
(a list of folders. eg :)
/storage/sdcard1/Pictures/a
/storage/sdcard1/Pictures/b
/storage/sdcard1/Pictures/c
/storage/sdcard1/Pictures/d
и так далее. 
(and so on.)
как получить список вида: 
(how to get a list of the form:)
a
b
c
d

используя блок 'for each item in list' , либо как-то по другому. 
(Using 'for each item in list' block or somehow differently.)
у меня 
ни как не получается. 
(It does not work.)  
подскажите

-- 
Google translate is not very kind to your text, so maybe I do not understand, but I think Taifun's file extension will help: http://puravidaapps.com/file.php
Cheers, Ghica.

-- 
именно с помощью указанного расширения я получил список директорий 
(it is through this extension, I received a list of directories)

/storage/sdcard1/Pictures/a , 
/storage/sdcard1/Pictures/b , 
/storage/sdcard1/Pictures/c , 
/storage/sdcard1/Pictures/d  

которые находятся в /storage/sdcard1/Pictures/. 
(which are in the / storage / sdcard1 / Pictures /.)

теперь мне нужно получить список названий директорий (a,b,c,d) , без /storage/sdcard1/Pictures/ 
(now I need to get a list of folders (a, b, c, d) the names, without / storage / sdcard1 / Pictures /)

-- 
You take the list that you have as result from the file extension. You use the for each element in list block, and in the do part you split the text on / , which gives you a list and you take the last element of that to add to your listpicker.

Some documentation about lists:
List Blocks, by Sajal Dutta:
http://www.imagnity.com/tutorials/app-inventor/list-blocks-on-app-inventor/

Chapter 19 of the App Inventor book:
http://www.appinventor.org/bookChapters/chapter19.pdf

Displaying a list:
http://ai2.appinventor.mit.edu/reference/other/displaylist.html

Cheers, Ghica.



-- 
 
я сделал вот так. но у меня получается список в обратном порядке. 
(I did like that. but I get the list in reverse order.)

-- 
Your global index is probably 0, therefore you are inserting each item at position one, which gives you the list in reverse order.
Use the add item to list block instead.
Cheers, Ghica.

-- 
большое спасибо. это работает как надо. 
(many thanks. it works as it should.)

-- 

Google Chrome


I have been using Chrome with App Inventor for over a year now without any issues.  Lately I find it very difficult to connect at all.  Is anyone else having these issues?
error.PNG 표시 중
-- 
Hmm.. still having this issue.  I have not been able to connect all day now.  I have tried my desktop and my laptop both, even my cell phone but its the same.  Since different computers have the same issue I do not believe this to be a hardware issue.  I have tried Chrome, Firefox, and even that Microsoft Edge browser (I know I know) and they all act the same.  So I do not believe it is a software issue.  The only thing I see in common at this point is possible my App Inventor acct/data?  Is there any way this can be checked?

-- 
Interesting.. here is something else I just tried.  I have a total of 4 projects in my account and the other three open just fine.  My issue is with just the one project, the one I need to access the most as luck would have it.

I guess I need to suck it up and restore from a previous aia version and try again? 

-- 
How big is your project? How big the images are?
Do you have a lot of blocks and/or components?
Did you try opening it in another browser?

-- 
There's also Maxthon, if you need a completely fresh browser.

-- 
The project is about 3.3 megs.. is not graphic intensive (in my humble opinion) but there are a lot of blocks.  I recently converted the app from 5 screens down to 2 but it was acting up a little before I did that.  Once I do get it to load everything works fine.

I did reload from a saved AIA file and that fixed one problem I had but does not fix the time out issue..

I have tried different browsers and seem to have the best luck with Chrome, although this morning I cannot get it to load at all.  I have been trying for an hour now but keep getting the time out message.  I have not tried Maxthon but will, maybe it will be lucky for me.

-- 
Uh-oh ... but there are a lot of blocks ..  

You are aware that the Google server MIT uses 'times out' after 60 seconds.  This is a limitation imposed by Google.  This means that if your Project takes more than 60 seconds to load, it will time out.  Other things can cause this...I have a project that contains many html files, total size perhaps 1 MB. The Projectt uses relatively few blocks.   It loads or does not load apparently randomly depending probably on Internet traffic levels.   This behavior probably happens because loading numerous files is probably time intensive just as resolving a large number of blocks causes time outs. Once in a while the Internet connection is good enough to just barely load before timing out I suspect.

You probably have already searched for solutions but something here might help  https://groups.google.com/forum/#!searchin/mitappinventortest/blocks$20limit%7Csort:relevance  give you more ideas for Project optimization.

MIT has recently made some changes that make loading large numbers of blocks more rapidly but it does not appear to be helping you significantly.  We do know that busy screens (with lots of buttons and layouts etc), loading many html files or even huge text files and large numbers of blocks will time out.    I do not think anyone has done research concerning how many blocks is too many or how many layouts will elicit a time out   With holiday shopping clogging the Internet, be aware that the Internet itself is frequently slow over the past few days.    You might get a positive result with one of the third party versions of AI2 that reside on your PC.   Unfortunately, these clones work but have their own issues...you might try a stand alone clone as a solution and let us know what happens.

Yes, time outs are frustrating and might be ameliorated using a stand alone version of AI2, but then again might not.

-- 
Third party AI2 programs?  I am not aware of any of these and yes, I would like to try one out.  Can anyone point me in any direction for one of these?

I tried optimizing everything to one page, thus giving me a lot of buttons and things going on just like you guys said.  I suspect this is the cause of my issue now.  I do have some older AIA files that I could load, taking me back a few versions and that should help but that will be more of a last resort for me.  Combining the code to the one page fixed a lot of other issues I had going on and would prefer to keep it that way.

I am convinced that my issue is size, or too many blocks in particular.  Since App Inventor was designed to be a teaching platform I think it may be time for me to figure out how to convert what I have in to the native JavaScript and move to Android Studio.  I have seen articles on the net about converting APK files to Java by jumping through a lot of hoops, is this the easiest way to go or does anyone know a better way for me to try?

-- 
the offline verisons you can find here
Overview: Different App Inventor Distributions and Versions

see the following general tips and in your case especially #2 and #3 

1. Use different screens wisely

Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantagesbecause in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed... See also Martyn_HK's example about how to use Tabs in AppInventor and another example from Cyd


3. App Inventor works best if you use images whose size matches the size you want them to appear on your screen. If you import larger images into your app, your app may run out of system memory. Using Images with App Inventor

4. Avoid redundancy
Probably it helps to read chapter 19 - 21 in Dave's book http://www.appinventor.org/book2 to get an idea how to do DRY programming with App Inventor - Don't repeat yourself 




Taifun


-- 
I tried the 4 different App Inventor distributions listed in the above post, and seem to having some luck with Thunkable.  The others are giving me errors that I assume have something to do with compatibility but of course I have no way of knowing.

I did get Thunkable to load one of my older AIA files and am now trying my newest to see if I can get anything at all.

If this doesn't work for me then I will try the local version (which seems like a good idea to me)

And if that doesnt work I guess I just need to learn Java scripting and go head first in to Android Studio or Eclipse.

Thanks for all the help and suggestions, one way or another I am going to beat this issue.

-- 
Minimizing all your blocks helps reduce load on the Blocks Editor.

-- 
Ugh.. more frustration.  None of the third party online apps seem to be a good solution.  Most offer different commands (not a bad thing) but do not seem to be compatible with my blocks and code.  So I am trying the offline route.  I managed to get AI LIVE to come up to the Developer screen but it does not want to load my version either. The blocks do not show at all.  I am trying to get the regular App Inventor Offline June 22 2016 version to work but can't. I seem to get the same Time Out issue as the online version.

I don't know what I can do now.  I have sections of my code that I know I can strip out to streamline and make it smaller, but if the app won't even load I can't get to my blocks.  I fear I have programmed my way completely out of App Inventor for this project.


-- 
the suggestion was to use one of the offline AppInventor versions...
see also the note in red below and try AI2U


There are the following offline AppInventor personal server available (1:1 copy of the MIT online version): 

• App Inventor Offline by Hossein (latest version as of June 22, 2016, which is identical with MIT App Inventor Version nb149 as of June 15, 2016), 
in case of questions, please ask in the the AppToMarket/Appybuilder forum (fomerly also known as AiLiveComplete offline)

• AI2 Ultimate by krupong (latest version AI2U 3.9 as of Sept. 13, 2016).
in case of questions, please ask in the Ai2U forum

Both are  1:1 copy of the MIT version without additional features. The main advantage is, that you do not need internet connection and you can build larger projects (> 5 MB). The disadvantage is, it takes time for the authors to build a new version, so the offline version is not always identical with the current MITversion. Therefore if you use one of these personal server, make sure, you use the most recent one, this will be the version most similar to the current MITversion. 


-- 
You are also welcome to try one of our more experimental servers at code.appinventor.mit.edu.

This is a version of MIT App Inventor not hosted in Google's App Engine, so the limitations imposed by Google are not present.

-Jeff

P.S. Note: We will be changing out the hardware that code.appinventor.mit.edu runs on this week, so there may be brief outages


-- 
I was able to load my 120 button, 120 label dog into the new server (all blocks collapsed.)
It's a fast server (so far.)

-- 

Extension - Top Bar


I have an idea for an extension, in android studio there is a nice top bar, is there someone who can make an extension to have this?

-- 
are you talking about the action bar?

this is currently not possible as extension, see the App InventorExtensions document

Note:  One limitation of the current extension component implementation is that it creates non-visible components only (i.e., components that do not show on the designer screen).   MITplans to remove this restriction in future versions of the extension component system

-- 


How to push a button in a webform


i have to push a button on a webform,

<div class="buttonBar">
<button type="submit" class="button" title="Send the message"><span class="caption">Send</span><span class="ico">the message</span></button>
<p id="isatPhone_validationMsg"></p>
</div>

inputs i can make, the agree button i can click, but how to push this button ?


HELP

-- 
here the Snapshot:


and attached the .aia

the problem is that i cant see, if the "send" button was pushed ...

when i start the app, i get the first view, datas are in and agree is pushed too,
but after i pushed manualy the send button, a get the "Thank you" notify ... then it is sended ...

looks like, the submit do not work ... ?!?

 

then i push SEND by hand 




-- 
I'm glad you like my example
concerning your question, see my answer here https://puravidaapps.com/inject.php#q

-- 
thanks for your answer,

i believed that there is a ID for the SEND button, in line 73 of the Sourcecode of the page...

http://connect.inmarsat.com/Services/Land/IsatPhone/SMS/sms.html

Line:
70   <div class="buttonBar">
71     <button type="submit" class="button" title="Send the message"><span class="caption">Send</span><span class="ico">the message</span></button>
72
73     <p id="isatPhone_validationMsg"></p> 
74   </div>

if  i have to use on of the line 71, which on i shold try to use 
so that i can use simple codes in Inventor ?


-- 
this screen shot shows the class="buttonBar"
is the ID   "isatPhone_validationMsg" not usable ?



-- 
see my updated answer here https://puravidaapps.com/inject.php#q

-- 
what the hell is :    <p id="isatPhone_validationMsg">
in line 73

the class starts with <div class="buttonBar">
the the button wih type, class and title, in between class="caption" ...

then this <p id="isatPhone_validationMsg"> and finish with /div
is this the ID i have to "click" on ?


Line:
70   <div class="buttonBar">
71     <button type="submit" class="button" title="Send the message"><span class="caption">Send</span><span class="ico">the message</span></button>
72
73     <p id="isatPhone_validationMsg"></p> 
74   </div>

-- 
that's just an empty paragraph and has nothing to do with the button itself

PS: btw. this is an App Inventor forum
for HTML and JavaScript questions please ask somewhere else. thank you.

-- 
i have no idea how to push this "Send" button, without a ID.
Do you have ? 25 is ok for a professional help and working code.

I know that the EZSat and the SatWay apps also can send sms to all the satellites ...
So why not me ?

-- 
so with your support i can now extrakt datas from source code of web pages nad send them by sms to Satellite phones.

still one problem :

the message is only one line, no /p or </br> is usable
how can it maybe solved to make multi line messages for the inject message value

like:

line 1 is this
line 2 is this and line 3 is here
and so one ...

any idea ??

-- 
try \n
Taifun

-- 
no it do not work, it is destroing the message and the inject too
wenn i exchange the \n with ... it loks like ... below
with \n nothing is happen



-- 
the message is only one line, no /p or </br> is usable
try <br>

-- 
and something else to try http://stackoverflow.com/a/8627926/1545993
let us know, if you get it working...

-- 
see my solution in Q2 here https://puravidaapps.com/inject.php#q

☞ inject.aia

--