2017년 1월 5일 목요일

Screens


Swap between screens


Hi, does anybody knows if I can swap between screens in App inventor without losing the information in the screens? I mean, I swap to another screen and when I come back to the original one, it is not in the same situation like when I changed to the other.

--
Save it all in TinyDB and reload fro TinyDB when you return via closing the other screen.

See the various methods of switching screens in this FAQ ...

Better yet, avoid the whole screen switching complication by stacking multiple invisible vertical arrangements, one per "screen",
and show them only one at a time.

-- 
Thank you very much for your fast reply!


-- 

Remove duplicate list entries


Hi, I have a messaging system where the system gets new messages that the current user has not yet read.
The problem is, if User A sends two messages to the current user, the list view has two entries: User A and User A.
So is there any way to remove duplicate entries?

-- 
which SQL statement do you use currently to get the list?

-- 

-- 
add a GROUP BY clause to your SQL statement like this
  GROUP BY SendingUser

-- 

Opening any Location On Google Map with input as co ordinates using app inventor


I want to create an simple android app using App Inventor 2.
Here i want to give coordinates i.e. latitude and longitude as input . I want to display the inputted coordinates on the Google Map.
How can I achieve this using an App Inventor 2?

--
Use the activity starter component, see also Using the Activity Starter

Show a map for a location
If you know a latitude and a longitude, you can use the VIEW action to show a map of the area:

Action: android.intent.action.VIEW
DataUri: geo:37.8,-122.23?z=10

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

--
Map It: Displaying Locations on a Google Map


--


Unable to link one table values to other and validate the login


I was trying to create an app which has login template for it, before that the user signs up using d signup screen.. In order to map the login and signup details, I was trying to match the values entered in signup and login page.. Getting too many errors. Any help will be appreciated.



--
see my answer here https://groups.google.com/d/msg/mitappinventortest/SSFZwNUrVGU/-uS3oPtPWrgJ

and: do not use the GetRowsWithCondition and the SendQuery block together
your sql statement must be created only using text blocks
the NumbersOnly property returns true or false, if you want to get the text of a textbox (which also can be a number in your case), use the Text property instead
there should be no other block after the GetRowsWithCondition block, you should do all the further processing in the FusiontablesControls.GotResult event
-- 
I tried as per ur suggestion, but I'm now getting an error in the send query. I've modified the fusiontables.gotresult also.
Please help.

--
Here's the latest verison of the blocks and error, do hv a look at it


--
as already said in the other thread, these are the recommended steps
a user enters name and password into a textbox
then send a select statement like this: SELECT password FROM <tableid> WHERE user = 'user name entered in user name textbox'
 now in the FusiontablesControl.GotResult event you can check the result:
1. if there is no row returned, i.e. the user name does not exist in the table, print an error message "user does not exist"
2. if a row was returned, now check, if the returned password is equal to the password entered in the password textbox
if no, print error message "password is wrong"
btw. normally it's not a good idea to store plain passwords in a table, a better solution is to create a hash value and compare the hash values then

currently you only get the header row back from the table and no data row, because there obviously is no mobile phone number available in your table, which is "get global mobile"... 
what about using the join block and join the text property of the textbox instead, same with the password?
also use Do it to find out, how your select statement looks like you are sending to the table, see also
Frequently Made Errors with Fusiontables and how to fix them


Edit: 2 screenshots added for recommended solution 

--
the data is already there.. I hv created a signup page which will allow user to enter their name email mobile and password.. I want to compare if d number exists in that table and if d pwd matches with it, then allow the user to login.

--
here is your fish
a complete login example using a fusiontable as simple as possible
--
Thank you, I'll check it and get back to u in 10mins :)

--
The code is working perfect, but its showing user not registered even though the values are in the table.. So i didn't understand how the values are going to get inserted into the list. I've done exactly as u hv sent!!


--
I would like to know if there's a way to send verification from mit ai2 when the user signs up, so as to validate the mobile number??

--
as already said, use Do it to debug your blocks, especially your SQL statement and the result in listResult
probably there are spaces in the textbox?
--
Yes, it shows an error saying cannot remove items fro list since it's empty. How do I populate the list, with the values in my sign up table?
--
I would like to know if there's a way to send verification from mit ai2 when the user signs up, so as to validate the mobile number??
probably my Telephony Manager Extension can help ...

The App Inventor Extensions are currently in testing. See the announcement for more information about how to use an App Inventor Extension. 

--  
what about providing a screenshot including Do it results of the sql statement and the result?
as a test, you also can display the result from the fusiontable in a label before splitting it into a list...
you know how to use Do it meanwhile?
see also tip 4 here 
shows an erro fr do it

--
this is no Do it result
you might want to learn first how to use Do it and then provide the requested screenshots
what about providing a screenshot including Do it results of the sql statement and the result?
you also might want to disable all blocks in the fusiontable control got result event and  as test display the result in a label instead
also it might help to first learn some basics...

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

--
Hope I'm right this time..



--
the sql statement looks reasonable... assuming, there are the columns Password and Mobile in your table... column names are case sensitive...
btw. you also can make your comment box larger like this
now: how does the result from the table look like?
you also might want to disable all blocks in the fusiontable control got result event and  as test display the result in a label instead

-- 


--
as you can see yourself, your screenshot of the fusiontables control got result event does not help very much
you can't use Do it together with local variables, you have to assign the value of a local variable to a global variable or a label instead
this is why I recommended the following
you also might want to disable all blocks in the fusiontable control got result event and  as test display the result in a label instead

--  
I hope this is what u meant.. Test button has the code which was in fusion table got result and result is the label which is displaying d result of test.. so maybe no value is retrieved and that's why its showing empty braces.. What do u think??



--
Shame you threw away the first element of lsresult before we got to
see its contents.  It would have been helpful to see what's going wrong.

--
What do u think??
well, I think, you probably start from the beginning to learn the basics...

it seems to be, it is very hard to understand for you, what I was recommending...
disable all blocks in the fusiontable control got result event and  as test display the result in a label instead
--

--
The data from the table is shown in the screenshot.



--
following your latest screenshot we can see, that both column names Password and Mobile are correct
you also used a Mobile number in the sql statement, which is available in the table (12345)
which means, you should have received the message "Login successful"
unfortunately you did not tell us, if you got it working now

concerning your Do it results:
you already learned meanwhile (?), that you can'T use Do it together with local variables, therefore you get package result, which does not help...
also I have to assume, you first used Do it on the label before sending the query to the fusiontable, which means, it displays the text "Result", which I guess was added from you as default label text...

so the correct sequence to get a reasonable result from the fusiontable obviously is
1. send the query to the fusiontable and wait, until a result has been provided (you will now also see the result in your label)
2. then use "Do it" to display the result in the comment box


--
No unfortunately even now it says user not signed up . don't understand a for what reason

--
step 1: do the Pizza Party tutorial to learn how to work with fusiontables and how to set up everything correctly


you also can try your connection using my test project, which you can find here
How to use the Service account option to connect to a Fusiontable


step 2: if you got step 1 running successfully, then continue with your project


PS:next time please provide a complete error message or a screenshot of the error message...

--
It is retrieving the correct password value, but its still showing user not registered error msg..I've completed the pizza party tutorial and I've set up service account authorization for this particular app.



--
after looking again at your screenshot, my guess is, there is a leading space before the \n, which results in an empty list in the end
therefore: remove that space and it should work...
--
The space behind the \n was the culprit. Removed it and now working perfectly. Just needed one more clarification, I also wanted to set up a forgot password button which when clicked on would ask for ur mob number and click on submit.. So is there a way that I could extract the password for the corresponding mobile number  and  send a mail from within MIT ai2, is it possible??

--

PS: this thread is about fusiontables. For other questions, please start a new thread next time. Thank you.

--

log in for fusion table


so to log in to my app the user have to create an account i used the fusion table for the acount values and a tiny web database for the password. it worked. but now i don't know how to set the blocks for the log in screen. in this screen the user will have to write down the email that is saved in the fusion table and the password that is saved in the data base to be able to log in. 

--
Why do you have userid in one database and password in another database? Is this for security reasons? This means you'll have to maintain 2 different databases.  
   
-- 
as already suggested it would be be easier to use only one database...

-- 

Emulator Not Working / After Windows 10 Upgrade ?


Hello, I just upgraded to - Windows 10 ; I am on Google Chrome but when I try and run the EMULATOR I get this windows error message ;
  emulator exe has stopped working ? I have included photo ? I already uninstalled  / reinstalled / restarted and still - NOT WORKING ???

--
how do i start it it wont work

-- 
See the Companion/Emulator section of this FAQ for various techniques and alternatives ...

-- 
I have windows 10 installed for a while now and the emulator still works. Try setting the emulator compatibility for windows 8.

-- 

App doesn't work on phone


I have stumbled across a problem with my app. My appworks on the emulator, but when I try to use it on a phone, then it doesn't work. Please help me!

--
you might want to elaborate, else nobody will be able to help

-- 
Might be the android version. What version android is your tablet and what version is your phone?

-- 

How do you make a recording play


I can't figure out how to make my recording play

--

Help with error occured when trying to load from my database


Here is the error i get when trying to load from my database.

Select list item: Attempt to get item number 2 of a list of length 1: (<br />)

What i am doing here is collecting information, then saving it to the database. At a later time when i try to recall the information i get this error. Any ideas??

--
Can you show us the blocks that deal with the list?

--
also use Do it to debug your blocks, see tip 4 here

--
this is the error from the do it blocks..

Error from Companion: Select list item: Attempt to get item number 2 of a list of length 1: (<b>Notice</b>: Undefined variable: csv_output in <b>/var/www/html/custcsv.php</b> on line <b>29</b><br />)

--
line 26 $values = mysqli_query($dbc, "SELECT * FROM customer");
line 27 while ($rowr = mysqli_fetch_row($values)) {
line 28  for ($j=0;$j<$numberOfRows;$j++) {
line 29  $csv_output .= $rowr[$j].", ";
line 30 }
line 31 $csv_output .= "\n";

--
 Undefined variable: csv_output in <b>/var/www/html/custcsv.php

it seems to be, there is an error in your php script, so what about defining that variable first?
see also my working example here https://puravidaapps.com/mysql.php


-- 
Select list item: Attempt to get item number 2 of a list of length 1: (<br />)
error.jpg 표시 중

-- 
use Do it to debug our blocks, see also tip 4 here
Top 5 Tips: How to learn App Inventor

as the error message is trying to tell you, your sublist only contains one item, which is <br />
you can't select a second item of a list which ony has one item


-- 
Don't assume that Web1.GotText will always give you properly formatted data for a csv table conversion.
It's like drinking from a faucet right after the Water Department flushed the lines for sediment.

Create a new global variable ResponseContent and set it to the responseContent you receive at the entry to Web1.GotText 
so you can drop it into a Label.Text or a DoIt to see what kind of polluted data you are trying to digest.

-- 


Need help with Error Handling




For the purpose of learning error handling in AppInventor2. 
I am trying to read non-existed file. 
The If Block is not working. No error message. 
Can someone please tell me what's wrong with my program blocks? Thanks.

--
remove that if condition to first find out the errorNumber
then add an if statement like this
if errorNumber = 2101 (assuming the errorNumber is 2101)
then...

-- 
Let's say a Button click may produce more than one error, may be 5 errors.
I do not want to use 'if, elseif, ..., else block' to deal with every individual error number.
Instead, I want to use the Button component for all the errors caused by the same button, issuing the same message.
If 'get component' = 'ButtonRead"; for example
doesn't seem to work. I tried also 'functionname', it is not working either
If 'functionname' = 'procedureRead"; for example
Please help again. Thanks.


-- 
It now works.
My solution is
If  'functionname' = 'ReadFrom'

-- 


Fusion table for map


I want to ask how to display map of location from fusion table to app inventor?

--
From fusiontable? If you do this, then your data is static and won't be able to get your current location.
Do you need to display the map based on lat/lon that comes from fusion OR you want to display the current location based on locationsensor?

-- 
Yes i want to show "map of location" that come from fusiontable not from location sensor.
So i can see all of map point that store in fusion table on android device


--
Then, check out AI MapIt tutorial HERE
Also, check out the blog post HERE for pulling data from fusion table.


maplocation.jpg 표시 중

-- 
no. i already success to work with fusion table i just want to know how to display "map of location" in google maps in android

-- 
Up

--


maze in App Inventor Developers Library


Re: Maze Maker.

This is great fun to watch the app build the maze square by square. With the new "sharing" component in AI2, it's easy as pie to send the maze as an ...
14. 7. 25. 작성자: Jess Sanders - 작성자 4명의 게시물 6개 613회 조회

Re: Ball, Canvas: Bounce a ball off a drawing on the Canvas.

I have been created a maze game for a school assignment and it took me awhile to get the maze generation working but now a new problem has ...
14. 11. 5. 작성자: Scott Ferguson - 작성자 4명의 게시물 5개 624회 조회

Canvas flood fill an area.

... are described in detail below: 1. building a list of points inside the figure boundary This is accomplished by using the left-hand rule of maze solving.
14. 2. 1. 작성자: Scott Ferguson - 작성자 2명의 게시물 6개 629회 조회

AI2: Frogs-N-Flies -- a puzzle game.

This game project was inspired mostly by the game LightBot where you program a robot to hop about a maze of cubes to get to the end. The object of ...
14. 7. 10. 작성자: Scott Ferguson - 작성자 1명의 게시물 1개 153회 조회

Maze Collision Issues


Hi guys, I've searched through previous topics about mazes but I haven't found a working solution to my issue. I'm trying to build an educational maze app where the user uses four directional buttons move a character sprite through the maze, so an up, down, left, and right button that moves their sprite character by a number of pixels at a time. The maze lines themselves are in a separate, singular image sprite as one big "overlay" on top of the canvas which has it's own background and I've attached a picture of the UI to help visualize this. 

What I want is that: if the character sprite collides with part of (a maze line) the maze image sprite, I want the character sprite to be unable to pass the line, just like how you'd expect a maze to work. I've played around with many different blocks (canvas pixel color, canvas background pixel color, collided with, bounce edge), but I just can't seem to accomplish this. I thought of setting up an event to occur when the character sprite and maze sprite collide that would "reverse" whatever action that occurred when the user pressed up/down/left/right. For example, if the character sprite collided with a maze line after hitting the Right button, then it would move the character sprite left back to where it was as if the Left button was tapped. However, I also could not get this to work.

Any ideas?

Maze.png 표시 중

--
you might find an idea in one of Scott's examples here Maze in App Inventor Developers Library or Maze in MIT App Inventor Forum

-- 
You might find it helpful to separate the design aspects into a View - Model - Controller architecture.

The View part should be the only part that knows about pixels.

The Model design should be the only part that knows about the grid structure and the coordinates,
player start and destination coordinates,
as well as knowing how each  coordinate (measured in rows & columns, not pixels) has 
up to four possible accessible neighbors based on the four possible buttons.

The Controller part should know about the buttons, the choreography and showmanship of 
initiating and ending a game, and how to ask the Model to try to move.

-- 
The fling works great, but it doesn't translate the same way to up/down/left/right buttons unfortunately.

-- 
This is what I came up with.
It allows the hero ImageSprite to move around the maze based on the data stored in a csv table.

The data in the MazeMoves text file looks like this:

00,dr
01,lr
02,ld
03,r
04,lr
05,lrd
06,l
07,dr
08,lr
09,l
:
90,r
91,lu
92,ur
93,lr
94,lr
95,l
96,ur
97,ul
98,ur
99,ul

There are 100 rows in the table for each square in the puzzle.
This csv table is read into a lookup in pairs list. 
When an arrow button is pressed, the direction (l,r,u,d) is passed to a procedure which does a lookup for the row and column of the hero sprite, determines if that direction is allowed, then moves the hero if so.


As an aid to determining which directions are allowed for each square in the maze, I numbered each row and column 0 to 9:


So for row 4, column 3, the allowed moves are up (u) and down (d)
This can be represented in the list and csv table file as: 43,ud or 43,du

---
Happy Inventing!


-- 
Nice and simple!

-- 
Thank you so much Scott! I've been working on implementing it since yesterday for 9 other maze layouts, I really love this idea. I'm a student with less than half a year's experience with AppInventor and programming in general so a lot of those blocks initially went right over my head. However, I understand them all now thanks to your explanations and visuals and I'm gaining even more knowledge of concepts like this to use in app making. 

Thanks again!

--
Yay! :)


--