2017년 7월 11일 화요일

search results for thousand separator

you can "translate" this AI1 solution to AI2 http://puravidaapps.com/snippets.php# thousand. Taifun.
how could i automatically set a dot every "000" while i'm typing on a textbox a number? found some old solutions.
... do math on space characters, You'll have to create a pair of procedures, I'd use ones that produce a result, to insert/remove the thousand separator.
Or use this TextUtils extension(https://amerkashi.wordpress.com/2017/03/09/ textutils-extension/). -; Format number for thousand separator and to ...

custom keyboard

Today I made a custom keyboard! It works really good.
But there one problem. When I tab in any number, it stands in brackets. In the result of this problem is that the entered number cannot be compared or used.
 As you can see in the picture of my "code", I use a list to be able writing numbers over 9.  

I already searched for a solution in the web but i couldn´t find anything.
The problem is you're setting the .Text of the label to the value of Eingabe which is a list.  AI does the type conversion for you and represents the List type as text (String type).  Instead of getting 123 you get (1 2 3).
You need to either convert the list into a string by using a loop block and parsing out the brackets and spaces, or use the Text Join block in your click events to store the input as text rather than a list.

Thank you!
The "text Join Block" was the solution.
Do you have an idea how just the last number of the complete number could be deleted?


segment text
Remember you're actually dealing with text. Other languages call it 'string data' as in a string of characters. That the characters are numeric characters is inconsequential until you start to do math on the values represented. AI converts automatically so "9" + "9" = "18" and not "99" If you're new to programminghere's some reading about data types. AI has very weak Typing.

How is such a lenght block defined? -1 doesn´t matches.

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.

So in the marked part of the picture you can see a summary of my bad tryings. 
In this case I don´t know how a lenght block is defined.
I tried to say, cut the lenght to one number.

All your answers are here
Also in the Blocks editor just hover over the language block in question to get the quick version of how it works.

In the segment block:
 'text' is the text you're segmenting. In your case that's your global Eingabe.
'start' is the starting point in the text string for the piece you want to pull out.  In your case that's 1
'length' is how many characters your want to pull out.  Here come's the fun part...

The length block returns the number of characters in the text string you give it. Snap your global Eingabe to the 'length' block and it becomes number of characters in the string of text it contains. You want one less than that so add your math block. 
Thank you again! (:
Be honest with you, did you know that yust from the explaination in the Blocks Editor? Or is my english knowledge just to bad. :D

Here the Result of the Back Button!

I would like to make the keyboard input look more pretty, by doing blanks between every thausender step. (1000000 ----> 1 000 000) 
How could i do this? 

Since numbers will not display with formatting and you can't do math on space characters, You'll have to create a pair of procedures, I'd use ones that produce a result, to insert/remove the thousand separator.  Hint - Use text blocks Segment and Join in a loop. There may be someone here that has already done this and has sample code (Taifun?)

Note: In Canada, US, ..?.. the separator is a comma not a space so you might want to use a variable and, in the screen initialize block, load the correct character based on the device's region.

Here's a Thousandizer routine, with test examples.
See attachments.

To have this happen dynamically while you type,
you would need a fast clock routine that checks for
changes to your input, then if it changed,
run the text thru a routine that strips the separators,
then again thru the Thousandizer for a fresh format.

It's simpler to just take all the digits, and wait for
a Okay button click to reformat the entire input.

Whoops -

I just realized my Thousandizer is buggy.
If presented with 1024 it would lose the zero.

I should have used string functions instead of
remainder functions for my front/back split.

You get the general idea.

Here's the corrected version of my Thousandizer, with an extra
routine "nnn" to format numbers less than 1000 with leading zeroes.
See attachments.


RE thousands separator

Hi, Does anyone know how to add thousands separators and decimal to a label in AI2? 23599 eg the idea is that it looks like 23,500

I appreciate any help ....

you can "translate" this AI1 solution to AI2 http://puravidaapps.com/snippets.php#thousand

looks fine! thank you!
however now in AI2 we have local variables, therefore I suggest to replace the global variable result by a local variable...


I use this blocks for  thousands separator 

Nice solution, tumorlike :)

There is just one small problem, the thousands separator might be . or , depending on the country your phone lives in (And each has been used in the solutions above!). Here is a trick to figure out what it is:

The "random fraction" is a number between 0 and 1. If you see a , then the thousands separator will be a . and the other way around.


thousand separator

how could i automatically set a dot every "000" while i'm typing on a textbox a number?
found some old solutions

what about using one of these "old solutions"?


you might try a Procedure built like this.  It will even handle currency with decimals

See attached for the recursive way.
But for it to happen while typing in the number, you would need
a Clock timer to check if the contents had changed since the last check.
(global variable)

If the contents had changed, strip off the separator(s) and replace the .text
with the separated form of the number.
Make sure the Clock doesn't fire again during the update, using its enable flag.

But you should not set the numbers only attribute, because I think it will only allow , as thousand separator.

thanks all.
expecially abraham :-)

You could also use AppyBuilder new extension (see attached) - get it from here: https://sourceforge.net/projects/appybuilder/files

thank you for the new extension...
concerning the FormatThousandSeparator method you might want to add an option to have comma or dot as separator...

Regarding option for comma or dot as separator, that is already built-in. It automatically uses the country format.
Also, checkout the List manipulation extension for List ordering, reversing, sorting (ascending / descending): Shuffling / Ordering Lists

great! perfect!

well, great stuff!!!

hossein, i have a question for list sorting

if i have a list

1) hossein, 30 mln, milan, nice
2) diego, 20 mln, naples, nice

how could i sort the list taking a middle value (like milan-naples)?

Are you saying you want to take like 3 value from every list item?
If yes, You have 2 Lists. Use "select List Item" to get list items by index.

Are you asking to sort this table by its third column?

If so, see the merge_sort app in the Gallery at

and make your own version of the precedes function,
which decides if one item precedes another item in the list.

In your case, the precedes function would accept two rows from the table
being sorted, select their third item, and compare those items.

it seems the perfect solution.
actually, i already downloaded this project, but months ago...when i did not understand almost anything about appinventor

but right now it's difficult too :-D

thanx aby!


Received SMS>>Password control>>Localization>>Send position in SMS

I'd like help.The attached program will stop midway.Indicated by a program that the message is received, but will not start the LocationSensor, only when I step the program. Then sends the message.
Reading SMS, Send SMS, 
Positioning enabled in phone.

it takes a few seconds until the location is available make sure to enable GPS then after a few seconds you should see gps inthe AvailableProviders property now set the ProviderName to gps and set ProviderLocked to true
this should give you the best result, assuming you are outside of a building and have a good gps signal...

Thanks for quick you answer.Sadly, I waited a long time, but it does not start with the GPS search. 
When I enter the program will start immediately with the GPS search.The program is well written?

Here is how the LocationSensor works 

Exploring with Location Sensor in AI2
The location sensor object is used to communicate with the global positioning satellite receiver (GPS) in your phone/tablet. When the LocationSensor communicates with the built-in GPS receiver, the GPS can determine the location of your device.  The sensor can also work with network/wifi location services.  Finding a location using the network uses very different techniques to determine a location. Location means, the device's present latitude and longitude or it can mean your street address.

Are you showing all your blocks?    I do not see a LocationSensor.LocationChanged block in your project.  Did you place a LocationSensor control on the Designer screen?

When you read Exploring with Location Sensor in AI2 there is a section on how the internal GPS on your device gets a satellite fix.  When first turned on,  it  may take 20 to 30 seconds to get a fix.  A subsequent fix will usually be possible within 5 to 10 seconds depending on your hardware and where you are located and other factors.

When first turned on, before getting a fix, the locationsensor has a default latitude/longitude of 0,0 .  You know the GPS has a satellite fix when these are not zero.    

To give the LocationSensor time to acquire the required satellites, you might include a Clock in your code to provide up to perhaps 30 seconds delay.

Be aware HasLongitudeLatitude

If true, Android device can report longitude and latitude    it does not mean it has a satellite fix, all it means is the device is capable of reporting latitude and longitude.   To actually get a latitude/longitude yu nee to use the LocationChanged event.

All block I showed. Yes there is LocationSensor control on the Designer screen. The problem is not the GPS.The problem is that on received message does not run "Message.Received". Only if I enter into the program. 

Message>>ReceivingEnabled>>Always, but not so function.


This blocks builds a URL for querying Fusion Tables...

 "error": {
  "errors": [
    "domain": "usageLimits",
    "reason": "keyInvalid",
    "message": "Bad Request"
  "code": 400,
  "message": "Bad Request"


Passing multiple data between screens

I'm looking to pass 3 data results from one screen to another. I've made a list like the one following but I do not understand how to retrieve my data in the other screen? Is this even possible with multiple data?
I know that I will have to use the "Get value" in the new screen initializing but I don't know how to write it down using a list oO

Thank you for you advices :)
Hi, try this...


How do you transfer data between two screens?

I am passing on a question from a student who is participating in an App Challenge competition.  I am not a computer programming teacher but am a teacher sponsor.  They are trying to transfer data from one screen into another.  How is that done.

How to pass values from one screen to another screen by Scott

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 App Inventor and another example from Cyd.
It does not look like you have used the forums yet, as a search using the search box above would have returned several threads about this topic.
See for example this thread ...

Advice: Before posting, it's a good idea to search in this forum. Many others have likely run into problems similar to yours. How to search see screenshot.
Also, you can transfer data from screen to screen via databases or files to read.


error on tapping game

I was just trying follow one of youtubers program exactly the same and this error occurs while running 

and some of the function isn't working as its intention...

what about using Label3.Text instead?
it would help to rename the label components to avoid confusions like this...


Support for building apps on API Level 4 in App Inventor - Better Tablet Support

We've been working to take App Inventor out of screen compatibility mode, and that work has now been merged. This hasn't made it to a release yet, but it will soon. We will announce the changes in the forums when this happens.

What does it all mean though?
For starters, App Inventor will not support Android 1.5 (API level 3 - Cupcake) anymore, but we are compiling against Android 1.6 (API level 4 - Donut). We know there aren't a lot of devices out there still working at this level, but the change from level 3 to 4 was a rather large step to take, mainly because of the already mentioned screen compatibility mode.

Up to now, all App Inventor apps would be automatically scaled by the system to make them look the same in all devices, no matter their resolution or screen size. This sounds good, but the effect of this was that most elements would look rather awfully oversized on bigger screens such as tablets.  From now on, the resolution of the device will be used, and apps will look much better in larger screens with higher resolutions. As a drawback, the App Inventor designer will be a bit less in sync with what's actually being rendered on the device, but we've done our best to keep things as smooth as possible. If you find any issues with rendering in the designer please do get in touch with us through the forum.

What other changes have been made?
We have added a check to change from Tablet to Phone preview mode. It basically resizes the viewer so that you can see how the app looks at two different sizes. We are using Nexus sizes as generic here, Nexus4 for phone, and Nexus7 for tablet. As you can see in the screenshot below, we have also added the buttons bar found in most newer devices. The two changes are highlighted in red.

Another big change is that now all sizes for elements are density-independent pixels (DP) instead of hardcoded pixels. You will see a change in the Width and Height boxes in the designer.

The concept of DP is a little hard to grasp. Some people compare it to using percentages for sizes in HTML, but that's not quite correct. This is the definition used in the main Android docs:

Density-independent pixel (dp)

A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way.

The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. You should always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.

There is an additional property that has also been added to Images: scaleToFit; checking this box you can make an image fit completely the size of its enclosing area, for instance if you fill the parent in width or height, the image will fit the area (the image will not keep its aspect ratio, so be mindful when using this property).

So, with all these changes, what are the things to watch out for?
Some apps might be affected, especially those using hardcoded sizes in pixels. We have made many tests and the majority show very little differences, but there might still be some differences.
The other thing to watch out for is if you were using any tricks to grab the height and width of the screen to size your elements. Watch out for problems in there and please report whatever you find.

And what's next then? Well, this change opens a number of possibilities for App Inventor apps. We can start thinking about using a targetSDK level now, even providing a property in Screen1 to allow the user to choose which level that is. We could also start thinking about moving to API Level 8 (Froyo) as there are not many devices using a level lower than that. But probably the most important change here is that we can now start using support libraries and think about adding some of the most used design patterns in Android, such as Action Bar, navigation patterns, or even themes.

This is all a bit far ahead, but there's no technical reason stopping us now from working on changes like those. If you want to help with any of these projects, do get in touch through the open source forum. Great times ahead!

Problems loading projects?

Google Cloud Services has let us know that they've discovered the source of the storage layer problem that was affecting App Inventor between December 11 and December 18.  It had to do with an update to a piece of the infrastructure that they had just started rolling out.  We regret that some people have lost work, but at least we can be have some confidence that this particular failure has been resolved.  Even so, as always, it's best to maintain local backups of large projects whenever you can.

Information below this line documents the history of this incident. Feel free to ignore it.

NOTE: WE BELIEVE THE PROBLEMS ARE FIXED. However it is always a good idea to backup your projects and keep copies of your sounds, images, etc.

Summary: Beginning on December 11, we were having problems with storing “assets” (image, sounds and other objects that you upload to your projects) on the Google servers.  This made make it look like some images (or other assets) were missing when people loaded their. projects.   We worked with Google, and resolved those problems on December 18 by updating some of the libraries that App Inventor uses.

Although the problems are resolved, it is always a good idea to keep copies of your assets (images and music) on your local computer, in case similar problems should occur in the future.

Here is some information we published while the problems were occurring.  We’re keeping it here as a matter of general interest.

If we fail to read an asset when you load your project, we substitute a zero-length file. Be careful exporting your projects, as assets may be missing from the “.aia” file exported. Make sure you keep a local copy of your assets on your own computer.

We have been making modifications to the system to mitigate the worst of the problems. In particular we will never serve up a missing asset to the “buildserver” when you package an App. This ensure that if you successfully package an App, the resulting APK is valid. If we fail to read an asset, you will get a “Build Failed” message. If this happens, just keep trying the build. It may work the second or third time around. If it never seems to work, you can remove your assets from your project and upload them again. This may help.

UPDATE: December 18, 2014 21:00 US Eastern Time (UTC-5)

Working with Google Engineers we were able to diagnose and solve the problems that were causing assets to not load properly. The system should be operating normally again.

UPDATE: December 17, 2014 21:15 US Eastern Time (UTC-5)

We have changed the way we are storing assets (images etc.) If you continue to have problems, re-upload your assets. They will then be stored in a different storage system at Google, one that appears to still be working. Once you do this, you should be able to use/build your projects normally.

UPDATE: December 16, 2014 18:50 US Eastern Time (UTC-5)

We are continuing to work with Google. The occurrence of errors in the logs are decreasing. So this problem is likely affecting fewer people.

UPDATE: December 14, 2014 21:30 US Eastern Time (UTC-5)

We have updated MIT App Inventor to ensure that if you package your App and the “build” succeeds, your resulting APK file (the packaged App) will be valid. If we have trouble fetching an asset during the build, the build will fail. If a build fails for you, try it several times. See the advice in the summary above for more information.

UPDATE: December 14, 2014 13:44 US Eastern Time (UTC-5)

We continue to work this issue. The error rate is currently modest. Things to keep in mind:

⦁ If you export your project to a .aia file assets may be zero length in it. Make sure you have copies of your assets.
⦁ If you build a project (package an APK file). Make sure all assets are in the APK file before you share it with others. We are investigating making a change in MIT App Inventor that will cause builds to FAIL unless all assets were successfully found, so you can trust generated APKs if the build succeeds. We’ll post an update here when we have such a check in place.

UPDATE: December 14, 2014 10:10 US Eastern Time (UTC-5)

Our logs logs are still reporting errors in retrieving files from Google Cloud Storage.   We do not know the cause of the errors, and are working on the issue with Google Support.  Until this is fixed, you may find that some images have “vanished” when you go to work on your project.   It appears to us that these images are still on the App Inventor server, so simply switching away from the project and switching back might help.   But also, as you are working, be sure to keep copies of your images and other media on your local machine, so that you can upload them again if necessary.  

UPDATE: December 13, 2014 17:05 US Eastern Time (UTC-5)

We have deployed a new version of MIT App Inventor. This version has some more aggressive retry code to attempt to fetch assets that are giving us errors when we fetch them from the Cloud Store. It also has some additional logging that may help us get closer to the ultimate solution.

UPDATE: December 13, 2014 13:40 US Eastern Time (UTC-5)

We are aware that problems are continuing. Sometimes particular assets are unavailable (they show up as zero length) and then re-appear later. We are actively investigating the problem and apologize for the inconvenience.

UPDATE: December 11, 2014 23:15 US Eastern Time (UTC-5)

We have deployed the fix so that projects with a zero length asset should now behave properly.

UPDATE: December 11, 2014 14:00 US Eastern Time (UTC-5)

We have identified a bug in MIT App Inventor where if you upload a zero length asset (aka an empty file), your project will become corrupt. In particular you will not be able to build it, export it or checkpoint it. 

However you can continue to work with it.

We have a fix, which we anticipate deploying this evening. Once deployed, all projects affected by this bug will work normally again.
December 11, 2014 11:30AM US Eastern Time (UTC-5)

If you are having problems loading or exporting your projects (you see the “red bar” with an error message). This *may* be caused by a problem that appears to be in the Google Cloud Storage (which we use for storing projects). Some projects lost assets (images, sounds, etc.). When this happens the project becomes corrupt and won’t load.

Although we cannot recover any assets that were lost, we are working on a modification to App Inventor that will permit your project to load, even if assets were lost. You will have to re-upload the assets and then your project should be fine.

We apologize for this inconvenience. We will update the “splash screen” and this document when we have more information.

-The MIT App Inventor development team