2016년 11월 21일 월요일

create text file with a new line with each append


Hi all, I am writing an app that appends 2 textbox text into a text file. I am using \n  after each write for the carriage return but the text file that AI2 creates looks like this:

" 363627" " ryuwuwiw" " 373636e6" "dhhehsjs " " 477372u" " ruejjej"

I need the file to be in following format so I can read the text as tab delimited file on a windows app:

" 363627" " ryuwuwiw"
" 373636e6" "dhhehsjs "
" 477372u" " ruejjej"

Any suggestion will be kindly appreciated!

Kind regards,
Sal

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

Taifun

-- 
Thanks for your reply Taifun. I have attached the block that I using to write to text file.ap2.JPG 표시 중


-- 
you can try to put your values into a list of lists and then use the list to csv table block together with the File.SaveFile block
Taifun

-- 
Thanks Taifun - do you have any example I can follow?

-- 
just try something and if you still have issues, then post a new screenshot of your relevant blocks
see also


Taifun

-- 
I need the file to be in following format so I can read the text as tab delimited file on a windows app


 Does your Windows app have the capability to import commaseparated values instead of tab delimited values?
That makes things easier on the AI2 side.
If not, you need a way to generate tab (X'09') characters on the AI2 side.
See attached TAB.png for how to do that.

If you are uploading your text file to Windows using the wrong program (NFS) you might be missing the automatic addition of CR (x'0D') to the LF characters.
Windows Notepad might not be satisfied with just NL as an end of line character.
Your Windows app might also need the CRLF sequence,

See my CRLF Gallery sample for blocks to generate CR and TAB.

ABG
TAB.png 표시 중

-- 
Thanks ABG, the desktop app does have an option to read .CSV file. Do you have any example I can follow to write the 2 textbox field as 2 comma separated values in one line?

Kind regards,
Sal

-- 

Allow other apps to share with my app


Hi,

I'm trying to figure out how my app could receive data from other apps on same system. For example, I would like to share the page url from Chrome browser into my app. Is this possible with AI? If so, which component will allow me to do this?

Thanks,

V D

-- 
The App Inventor can't make the App a program, the information. Better said: your App can't be in the selection of the program to share the information.
But you can send the Information that you want to share, than SMS or Google Voice, by adding a Texting component.
Nico

-- 
you can try to set an intent filter in the manifest of your app, see this snippet http://stackoverflow.com/a/5097734/1545993

to modify the manifest, you can use 

in case you get it running, you might want to provide a description of what exactly needs to be done

Taifun

-- 
Thanks for that Nico. I figured their was a limitation for this.

-- 
Thanks Taifun. I will check out the links and try what u suggested.

-- 

Phone or Tablet


We are going to develop app in a group of 4-5 people on school's Mac, we need some recommendation on Android device. Should we purchase phone or tablet? Which brand and type? There are just too many choices on the market. 

Thank you for the recommendation in advance!

-- 
To be able to develop and test apps that require the features of a phone (make phone calls, send text messages (sms), view the Web without WIFI (using a data plan, etc.) you will NEED a phone.  If you do not need those features, a tablet will be fine.  To test phone features, you must have a phone with a paid up phone plan; to test apps intended to work without WIFI, your phone will also need a data plan to use to test apps that access the Web.  Phones have GPS built in, some tablets do not.   If the device does not have a GPS receiver, your team will not be able to test apps that use Location information.  If you use phone's, you will incur monthly charges perhaps.

A tablet generally will have a larger screen.  A large development pallet is an is very nice for developers, especially if they are working in a group.


Some low end Android devices may not have the drivers necessary for using the USB option of developing with a device (drivers might not be available). If you will not use the USB cable and WIFI works for you this is not a killer issue.

Got your own 'inexpensive' Android phone or tablet already?  Why not just try it out...if it works, get one for the school.  You might also read this post 

Phone recommendation for classroom use 


✫ Android Tablet Hardware Requirements/Recommendations



My advice, get a name brand tablet.  What you get depends on your school policy w.r.t. phone calls/texting from campus, whether recurring charges are ok and the types of projects you will work on.  A tablet will work fine with WIFI and now days, even inexpensive Android phones have a GPS receiver.

Regardless of what route you go, it is advisable to borrow a tablet or phone similar to what you intend to buy and 'try out' developing with AI2.  When you find what works for you; get that device or one similar to it within your budget.


Have you tried AI2 from home yet to see if AI2 works for you?  Try before you buy will make the difference between satisfaction and disappointment.

-- 
Thank you for the advise!

I followed this thread http://appinventor.mit.edu/explore/blogs/hal/2016/01/two-app.html, and it seems Amazon Kindle Fire Tablet, 8G: $49.99 is a very good option. Do you have experience with AppInventor on this device?

-- 
No experience.  The head of the MIT development team wrote the article.   See also https://docs.google.com/document/d/1osjY0wsZbZ0Bt_JT153f-ZH4cmA9mcc0MXKhMely4aU/edit#heading=h.sm3824vkq394   

For a few dollars more,  you might shield your students from the bargain basement price adds that accompany the cheapest version of this tablet.  Also note, there is no GPS receiver, which may not be an issue because the AI2 LocationSensor component will possibly work using WIFI ... I do not know.

Good luck.  This will work fine most probably.


-- 


Get row with condition with variable


Hello to all,
I would like to select the NAME where the AGE is lower than a certain variable1 and HEIGHT is lower than a certain  variable2 where variable1 and variable2 contains 2 numbers inserted by the user.
Example: the fusion table contains the following two rows.

AGE - HEIGTH - NAME
18    -   1,7       - Thomas
25    -   1.8       - John

The user inserted '22' in the Textbox AGE and '1,75' in the Textbox HEIGTH and gets as result 'Thomas'

Thank you in advance to who'll help me :)

-- 
send a select statement to the table like this
SELECT NAME FROM <tableid> WHERE AGE < variable1 AND HEIGHT < variable2

Taifun

-- 
Hi Teifun,
I receive a parse error . I think that the problem is the way with wich I refer to the variables in the condition.

The condition is:
"età < AGE AND altezza < HEIGTH". I paid attentions to the empty spaces before and after the <.
Any suggestion?

Thank you

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


Taifun

-- 
Hi Taifun,
attached the block with the table and the error.
Thank you again

Immagine.png 표시 중
Immagine2.png 표시 중

-- 
instead of using the texts eta and altezza you should use the global variables eta and altezza instead... just use the join block to join these values ...

Taifun

-- 

Hi Taifun,
I tried but it does not work. I tried also to simplify but I received the same error. I attached a pict.

Thank you very much for the support

Immagine.jpg 표시 중


-- 
do the Pizza Party tutorial to learn, how to quotify your values, then try again
also use Do it to debug your condition, see also tip 4 here 

Top 5 Tips: How to learn App Inventor

and


-- 

App inventor and JavaScript. Example.


Hi friends, this is an example about App inventor and JavaScript.

1.- App inventor send datas to file pitagoras.htm. 3:4
2.- pitagoras.htm with JavaScript get datas and split cateto1= 3 and cateto2 = 4
3.- JavaScript calculates hypotenuse
4.- JS send hypotenuse to App inventor by
-  window.AppInventor.setWebViewString("Hipotenusa = " + hipotenusa);
and
-  document.write("<br /> Hipotenusa: <br />" + hipotenusa );  



--
note: as you know, before building the app you have to use a different path...


Yes, you also can upload html files as assets into App Inventor! There is only one special thing to consider: During development, you have to use the development path to the embedded html document:
file:///mnt/sdcard/AppInventor/assets/<NAME OF YOUR HTML FILE>.html

Before packaging the app, use the production path.
file:///android_asset/<NAME OF YOUR HTML FILE>.html

Taifun

-- 

Activity Starter


I want to create an app in which after clicking on the 'New Image' Button, an image component is inserted and the picture of the image is set to an image stored in a tag in Tinydb. How do I do that using the Activity Starter? What is the code required?

Thank you.

-- 
Why do you want to try to set a image in a tinywebdb?
You can set any image from every url as the picture.

Example.
when "new image button" click

You don't need for that a activity starter.

-- 

I don't want to set an image... I want to insert a new image component.

Thanks

-- 
you can't create new components during runtime of the app
what you can do is to prepare some image components and hide them
then as soon you need one of them, set it to visible = true

you also might want to reuse one or several components...
see for example this solution, which uses only one canvas to display several images 

Taifun

-- 
Thank you Taifun.


-- 

How to view the flag of the country where I am ?


Using the location sensor I would like to view only the country where I am  for  see the corresponding flag.How?

--
This tutorial will help you understand how the geo-location sensor works:


(But unless the street address - if given -  returns the country you are in, you will need to find a way of converting your lat/long values to country codes / images of flags, probably an external database somewhere)

Others may know more....

--
Thank you!
But its possible to have   street Francia,Italia

-- 
In which case, have a look at the other text manipulation blocks: "text split at", "start at text", or "split at spaces". You may have to "make a list" from the output of these and then select the correct index in the list to return your country.

-- 
Ok! Thank you!

-- 

Run time Error. Help me guys.


I want to notify if somone click RM 5. For early it is ok. All work but then it the run time error occur.Please help me guys. For many hours i think to solve it but failed.

Auto Generated Inline Image 1 표시 중


-- 
What about adding a title to the message dialog? You have an empty connector at the tile position that should contain something.
An empty text string would be OK, but maybe you could have a description of your notifier there, like "confirm"
Cheers Ghica.

-- 
The solution is you need to create a new project and it is ok.

-- 
Fine.
Maybe some bad stuff in the cache of your browser.
Cheers, Ghica.

-- 
I am sorry Ghica. Thats true like you said. We must put a text .It does not matter if the text is empty.But we must put the text beside the title then it will ok. The MIT apps is awesome  because i need to present my apps for next week. Thanks again .

--