2014년 12월 1일 월요일

ask

How to save the file in SDcard? And don't need the Internet



which file are you talking about? your apk file?

or how to save some text to a file on sd card?
in this case use the File component http://ai2.appinventor.mit.edu/reference/components/storage.html#File and the SaveFile method


Hello Kitty sound won't play

Is there something special that I have to do to get the sound to play on my Surface Pro 2 tablet?  I read somewhere to use Player component instead of Sound.  What exactly does that mean?



Sound and Player are different components.  Use Player, not Sound



I tried that and it didn't work either.  None of the apps that use sound are working.  Is that normal?



Some things to consider and check:

Is the volume turned up on your tablet?
Does the sound work on non AI2 apps?
What kind of sound file are you attempting to play?    How large is it (Mb)?
Do you have the sound file loaded in Resources (Media)?

Could you please post a png or jpg image of the blocks you are trying to use to play the sound.  You said you tried different things,
if we could see some of your code, we might discover the issue.



I have tried both player and sound components on Ubuntu and Mac platforms. The emulator is playing sound from the keypad but I cannot get the media to play.



Did you download the sounds from the site as well as the code?



Yes. I am on a Mac. The sound file is fine and has been uploaded.



It seems to be a problem with the emulator running the code block. I can see it clicking on the image but I just tried a code block to change the label text when clicked and that hasn't worked either. Do I need to do something before the code blocks will run on the emulator? I tried re-connecting but no change.



Viv... You're using a Microsoft Surface Pro?

AI makes apps for ANDROID... not iOS or MS...



I'm using the emulator - I am an A level Computing teacher not a novice. I have now had the emulator software installed on a windows machine in school. Still no joy on the sound. I will try out some other programs and see what happens.



Have you done Tutorials:


or read the AI2 free online eBook   http://appinventor.mit.edu/explore/ai2/tutorials.html   ... the links are at the bottom of the Web page.  It TEACHES how to use AI2 blocks to program.

A possible issue, is your emulator working at all?   Code a new project.   You are experienced so this should be easy.    Just place a Button on the screen, change the caption on the button to Hello; now Projects > Emulator  .    Do you see the emulator render the button and the word Hello?    If you do not, something is wrong with your emulator setup.

Until recently, the emulator was not possible to use on LINUX boxes.   It is supposed to be working now.    The emulator has always worked on Macs .

What type of sound file are you trying to play with AI2?    mp3, wav  or one of the strange ones?

You have NOT posted a screen capture image of your Ai2 blocks.    Without a code image posted, answering your questions and providing adviceis  difficult because anyone is guessing.   Our standard answer is "Try some blocks"     and that applies to teachers too.



Material Design.


App inventor does not have the tools to create a standard "material design".

Is there an easy way to change this?
How to remove the top title bar of the application feature to be directed?

--
The answer to your first question is here:  http://appinventor.mit.edu/appinventor-sources/

The answer to your second question has been discussed many times and you can not do it with standard app inventor.  You could  search in the forum using the Search for topics box to the right of the colorful google at the top of this page  using a term like title bar    or title bar remove.

--
you can remove the title bar with AppToMarket

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.

--
Can I remove the title bar without AppToMarket?

I made the program I put several times in google play and now when I remove the bar with AppToMarket the program is not accepted by google play.

What can I do wrong?

--
No... presently, in AI2, there's no way to remove the title bar.

--

Why m app inventor screen is not showing "My blocks"

Hello everybody,  I am new to App Inventor, I installed the software, however I do not get "my blocks" in the design tool bar?
Can anybody please explain to me why and how do I enable this feature.



Web Viewer Cache


i have a problem with the web viewer.
My web viewer is showing a fusion table an after an insert or an update of some rows it needs nearly one minute to show the results in the web viewer.
Is it possible to clear the cache of the web viewer?

--
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 the result in App Inventor...

--

Another Question about Backbuttons

Hi, I am working on a simple app with just a few different screens. The issue I am having is that I do not want to have a visible back button that takes users to the previous screen. I would, instead, like to use the Android's own back button at the bottom of the phone. Is it possible to input this function into my app? Any specific instructions would be greatly appreciated.



use the Screen.BackPressed event together with the close screenmethod



OMG is worked! Thank you so much!


Text file with a app

Trying to set a tiny db of text files on app error i get is the file not found. Thanks CC



Without a screen shot of your blocks, the forum members have no clue.  AI2 does exactly as it is told (usually) so you are not providing proper instructions or a correct link to the file.

Do or read this stuff and you will know what is wrong. especially the link on Controls ... you need to read about the File control perhaps?


TinyDB


Concepts






Other stuff (Activity Starter etc)   http://ai2.appinventor.mit.edu/reference/other/

AI2 free online eBook   http://appinventor.mit.edu/explore/ai2/tutorials.html   ... the links are at the bottom of the Web page.



Updating for emulator use from older versions of AI and AI2

I had checked the forums but there isn't anything about this. Do not know who specifically to contact . All the instructions in all the current books and online  are the same, and none tells the user NOT to do it from control panel, especially if there is Adobe software on the computer

While following instructions, created some new problems. (I do not usually use AI2 that often on this computer) and when I do, was using tablet/phone, or when at home...the wifi kicked in

instruction 1 said to delete all previous versions, so being the careful person I am, from control panel went to delete. It also was in the process of deleting ALL my Adobe software because of the similar extension (aia). Fortunately I stopped it in time and was able to reset from a restore/back-up and reinstall the Adobe software


Then went into every directory where AI and AI2 had been and deleted everything manually (saved the 2 drivers for phone and tablet) and cleaned registry


Then waited until I was wide awake, set a new restore point and did an image back-up, restarted computer....

DL the installation, files and installed. This is a potential problem if anyone tries to delete from control panel. I have one of the last non-cloud editions of the full Adobe pro suite


HtmlTextDecode does not show JSON response?

I thought HtmlTextDecode decodes the the text of the webpage?  The text of the following example is a json response. If I am wrong I apologize.

http://ai2.appinventor.mit.edu/reference/components/connectivity.html

How can I decode
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=41.455318,-75.651009&radius=500&types=store&key=

to a json response for my app. Right now  I have this:



The json response WILL vary, so I need to decode the webpage into json. How could I do this?



it helps to take a look into the documentation

text HtmlTextDecode(text htmlText)
Decodes the given HTML text value. HTML character entities such as &amp;, &lt;, &gt;, &apos;, and &quot; are changed to &, <, >, ', and ". Entities such as &#xhhhh, and &#nnnn are changed to the appropriate characters.

How can I decode
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=41.455318,-75.651009&radius=500&types=store&key=to a json response for my app

How would you expect the JSON result look like?
You will have to do this manually...



Try using JsonTextDecode and see if that does what you need.


Adding New Screen (Looked at tutorials)

This should be fairly simple, so I'm a bit puzzled why it's not working. Created a new screen called ToDoTwitter and made a button and here's the blocks:

I double-checked screen name--I even copied and pasted it just to be sure. But when I go to my phone and click, nothing happens.



in case the name of your screen is ToDoTwitter, this looks fine
see also 

The recommended method of switching screens in App Inventor


do you test with the companion app?
probably it helps to restart the companion app?
did you build the app and test with the apk file?



If you are developing with WIFI on your device, the change screen might not work using the button on your device's screen while developing.  Press that button and then .use the browser Screen button to change screens while you are still developing.  Try it.

Here is another way to safely change screens other than using a manager screen:

TribleHunter    http://puravidaapps.com/tribblehunter.php   Note, this method works after the apk has been built...use  the browser Screen button to change screens while developing... however when this code is in place in your app.   Having the close screen part of the change screen process will prevent the device's system memory from overflowing and crashing your app.   This method is more suitable in some apps than the screen manager Taifun recommended.   They both work.

However, you probably can do what you want with a single screen using methods described here:  http://ai2.appinventor.mit.edu/reference/other/manyscreens.html   

The usual issue developers encounter is attempting to change screens and not using the exact 'screen name' for the other screen.  For instance "ToDoTwitter" is not the same as "todotwitter" on Android devices; the coding is case sensitive.

Did you get the screen to change?



If you are developing with WIFI on your device, the change screen might not work using the button on your device's screen while developing.  Press that button and then .use the browser Screen button to change screens while you are still developing.  Try it.

Not sure how to do what you're saying here about using the browser screen button? 

Any, this was the issue (doesn't work using WIFI companion app). I'd tried restarting the companion app before I posted my question, thinking that could be it, but no go. I went ahead and built it and installed the apk file and it worked!


how to hide screen name and a question about appname

i'm making a app for our radio station (work in progress) and i have a few general questions.  

Is it possible to hide the screenname and the grey beam, don't know if that is the correct word :-) 
So where you see home  and where the colour is grey, can i hide all of it so you only see the app 

see photo 

Second question: is it possible to do something about the app name, when you make a project you have to spell the name without a space , so FreemindedFM of Freeminded_FM    But is want the app called Freeminded FM  and use a space in the name like all other apps on my phone, also it looks better.  See Photo for what i mean. Sorry for my broken grammar, this is not my first language :-)





You have to use an external tool to hide the titlebar... it's called App2Market.  You can find it here: AppToMarket.

In order to change the visible application name, do it from the Properties in Screen1.




Hello Enis , i will check out the external app, thanks

about the second question, a want to change the name of the app to Freeminded FM   , so when you see the icon on your phone it looks like Freeminded FM and not like FreemindedFM or Freeminded_FM   like in the picture, but if i change something at properties at screen 1 it's only the name of screen one and not the name of the app in general



Check out AppToMarket... it may have your answers Rene...



Ok, going to check it out this weekend.



Got it Working, no application bar and changed the name :-) apptomarket, Nice work

Emulater Outdated

The emulator appears to to be based off of Eclair. Can we get something more moder? Kit-cat or Lollipop based? Why has this not been updated. Also, the emulator frequently loses sync with the editor and I have to reset the connection and restart it continuously. Is that normal?



Ben...  If you're doing a lot of block changing and component management while connected, it'll probably disconnect.  The best way to work efficiently is to close the emulator when you're making lots of big, fast changes, then start it up again.  The emulator is from Google, and it's based upon the worst case scenario.  

Why don't you try the free emulators from Genymotion.  They're great, faster, and make development easier... plus, you can get various devices and OS versions.



Android Froyo only has about 2% of all android users and Eclair is pretty much completely dead. Really no reason to continue supporting it. As long as it works with Gingerbread.

Source: 

How do I get those emulators to work with app inverter?



Thanks for suggesting this.    We'll try to update the emulator to Gingerbread.   Meantime, it's worth trying Genymotion as Enis suggests.



The Google emulator that is installed with AI2 is not 'dated.'    It is the standard Google basic emulator.       http://developer.android.com/tools/devices/emulator.html

How to work with OTHER emulators should be part of the installation instructions for whatever emulator you choose.   You have to READ.

You were already given some advice by another poster... why not follow it and read the instructions?


Converting CMYK to RGB into the make color block?

I found a  conversion formula of changing CMYK to RGB, but when I try to insert my thumb posistions of the CMYK sliders into math blocks, then put those into the make color block,  Key is always messed up.  Pic related-  me trying to use the formula.


read txt file and seperate the lines by ":" or "," ...

im trying to develop an quiz-app.
I hope there is someone can help me... -_-

the function would be:

read a txt file from web (if possible without saving on smartphone)

txt file structure: 

What ist the capital city of germany? :Berlin :Muenchen :Duesseldorf :Mainz
many
other
questions
...

The ap looks like:

What ist the capital city of germany?

checkbox1_Berlin
checkbox2_Muenchen
checkbox3_Duesseldorf
checkbox4_Mainz

is it possible to seperate the lines in the txt file by ":" and change the checkbox_text to the possible answer?



yes, you can read the text file with the web component and the gotText event
let me recommend to use 2 files, a file for the questions and another file for the answers (in csv format)

Berlin,Muenchen,Duesseldorf,Mainz

then you can convert the csv format into a list of lists using the list from csv table block
have you already seen this example? https://puravidaapps.com/quiz.php
You could adjust it to your needs...



Hi Taifun, thx for your response!
I will try it and report!



I used the "list from csv table block" it works but the questions are in ()

another question: how can I read the question file AND answer file and do the result in various textboxes?



currently you are getting a list of lists, each item of the main list is another list which has 1 item

if you want to import a 1 column csv table as i this case, I recommend you to use the split at block and split at \n (new line) to get a simple list of the questions

another question: how can I read the question file AND answer file and do the result in various textboxes?
see again my example https://puravidaapps.com/quiz.php how this works for buttons, now adjust it to use checkboxes instead of buttons...

first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.htmlto learn the basics of App Inventor, then try something and follow the


what is my keystore password

i try to open my app in eclipse but i cant found my keytool password. what is this and how can i learn it ?



You cannot open your App Inventor project in Eclipse, period.


Using Mac keyboard with Emulator

Has anyone found a the trick to using the Mac keyboard with the Emulator? Works find with PC but want it to work with the Mac.


Randomly select a tag from a tinydb

Hi. I´m trying to randomly select tags, and the corresponding items, from large tinydbs. I'm trying first with a small one (see attachment), but I don't manage to make it work -and I suspect it is a very inefficient way to do it.

Thanks in advance for any help you can provide.




There is a Gettags method for TinyDB. This will give you a list of all the tags in the database. Then, from the list blocks, you use pick a random item. Now you have a random tag and you can access its corresponding content in the database.



Sorry, I did not look at your blocks well enough. You should set global name to the get tags result and not add it as a single item to a list you already have. Then it should work.



Works great! Thanks a lot for your help. I attach the code, just in case it can help someone else.



"Create New.apk" ERROR: The new .apk was not generated due to errors

I created am Ai2livecomplete apk and i tried to use  apptomarket v4,0 to change the app name to a new one with spaces for market.

It works well the step of "Create New.apk" button.   

keystore ok. manifest ok. but when i hit button "Create New.apk" it gives error. 

pls help.

"30Kas2014_0142.42:  Your Platform: windows 7

30Kas2014_0142.42:  Java Version: 1.7.0_72

30Kas2014_0142.42:  AppToMarket Version: v4.0

30Kas2014_0142.42:  Install folder: C:\tools\AppToMarket

30Kas2014_0142.42:  Your data was loaded from: C:\tools\AppToMarket\resource\config.txt

30Kas2014_0142.49:  BUTTON CLICKED: 1> Decompile

30Kas2014_0142.51:  I: Framework installed to: C:\Users\Bilgisayar\apktool\framework\1.apk

30Kas2014_0142.52:  I: Loading resource table...

30Kas2014_0142.52:  I: Decoding AndroidManifest.xml with resources...

30Kas2014_0142.52:  I: Loading resource table from file: C:\Users\Bilgisayar\apktool\framework\1.apk

30Kas2014_0143.05:  I: Regular manifest package...

30Kas2014_0143.05:  I: Decoding file-resources...

30Kas2014_0143.05:  I: Decoding values */* XMLs...

30Kas2014_0143.05:  I: Loading resource table...

30Kas2014_0143.05:  I: Copying raw classes.dex file...

30Kas2014_0143.06:  I: Copying assets and libs...

30Kas2014_0143.06:  I: Copying unknown files/dir...

30Kas2014_0143.06:  I: Copying original files...

30Kas2014_0143.06:  SUCCESS: your .apk was decompiled into: C:\tools\AppToMarket\temp_myDecompiles

30Kas2014_0143.14:  BUTTON CLICKED: 2> Update Manifest

30Kas2014_0143.14:  SUCCESS: Manifest updated: C:\tools\AppToMarket\temp_myDecompiles\AndroidManifest.xml

30Kas2014_0143.14:  Completed updates. If you wish, you many now update androidmanifest.xml here: C:\tools\AppToMarket\temp_myDecompiles\AndroidManifest.xml

30Kas2014_0143.18:  writing new .apk file:C:\tools\AppToMarket\myApks\animal_sounds_new.apk

30Kas2014_0143.19:  ERROR: The new .apk was not generated due to errors"



For this,  You don't need AppToMarket because ai2livecomplete has this feature built in.  Please post in ai2livecomplete forum and we'll follow there


Download Data from App into Word Processor

First off, I am a very novice self-taught programmer so no big words please =-)

I have created an app that collects information such as notes (text), photos, geotags, etc. I have figured out how to collect the information with the app and how to store it in a TinyDB. What i would like to do is download that info into a format for printing preferably in a word processing type document. I realize I can't do this with Microsoft Word, but I can't figure out how to transfer data from my app to the Google Documents on the My Drive. Any help or direction would be greatly appreciated.



Two simple ways:

1) email the text\ or image to yourself
2) use your device as a media device and read the files on your Android with Windows Explorer.

or query the forum for other ideas ; You could  search in the forum using the Search for topics box to the right of the colorful google at the top of this page  with terms like   Google Drive   google spreadsheet        transfer images    etc.   

More complex:
One of the users here has some complex examples (some are not free) ....http://puravidaapps.com/tutorials.php      of ways to communicate with Google products..that can be accessed from your PC..


GPS speed and direction are very unstable


In my app, I calculate the speed of the tablet (!) by using the following -

1. It reads the latitude, longitude and system time and stores them

2. When the location changes, then
   2a. It stores the previous data in new lat/long variables
   2b. It stores the new readings of the same data

3. It calculates the speed by
  3a. It calculates the distance between the readings by calculating the length of the hypotenuse of the triangle with right sides (difference in long readings) and (difference in lat readings) and converts from degrees to nautical miles
  3b It calculates the time elapsed between the readings by subtracting the times
  3c It divides the distance by the time elapsed

I calculate the heading by -

4a. It calculates the angle from atan2 of the differences in lat and long readings
4b. It uses the modulo function on the angle

These seem to give generally sensible results, but the values jump around a lot. If I am stationary, the speed never seems to fall to zero, it jumps around up to say 50 knots, and the track varies all around the compass, as if the data from the sensor were noisy. My commercial GPS apps give smooth results, but respond quite quickly to changing speed (say), so it's not as if they are waiting for a long time between calculations to improve the result.

Sensor parameters tried have been distanceinterval = 2 and 5, and timeinterval = 500 and 2000

Please can anyone suggest why this happens, and how to fix it?

--
Read the LocationSensor tutorial.
1) Your distance calculation is very crude; there are better algorithms .   Look up Haversine algorithm, it is a great short distance algorithm for calculating point to point distances over short distances ... less than 10s of miles but it is reasonable to several hundred.  Vincenty's algorithm is accurate over all distances.  Simple trig, what you are doing is accurate for about a block or two...because of the curvature of the Earth.
2)  You will get 'descrepencies' in the reporting of Latitude and Longitude easily up to 40 or 50 meters.  Read the description of Accurracy in the tutorial.  The numbers reported by a GPS has a confidence of about 68% reliability that the fix is precise.  A GPS reading can be as precise as two meters +/- or easily +/- 20-30 meters depending on the number of satellites that the GPS actually used to get a 'fix'.  AI2 tells you how good the fix is with the Accuracy parameter.  Some compilers using Java can also tell how many satellites are actually used with the NEMA data ... AI2, unfortunately, can not capture that info.

So, if the fix is off by 2 to 40 meters, so will your distance calculations.
Ah, if you are setting the distance interval to 2, I understand a previous question,  AI2 and phones/tablets do a TERRIBLE job of using that parameter when the value is low.  Try using 100 meters and then your GPS icon will not stay solid.

3) What you measure is an instantaneous velocity...not the average velocity..when you measure discrete points.

How to fix?   The LocationSensor tutorial provides some remedies...

--
Thanks, Steve. All useful info which I'll incorporate. GPS still seems to be not working after the app closes (or even the tablet goes to sleep) and re-opens but I'll take on board the new info and do more experiments and post again if I'm stuck.

--
Hmm, having looked it up, I think I'll pass on Vincenty's algorithm.......

--
... but the Haversine was easy and seems to have improved it.

--
as a part of my app I need the same functionality, and was wondering could you please give me an advice for the following:
My distance calculation is Ok, but I'm having troubles with calculating time difference (getting run time errors of a  kind "operation cannot accept arguments like 1417329124337")

So did you use system time for all the readings? Converted it? Or maybe some call Clock1.FormatTime (Clock1.Now)?

--

Bluetooth error 507


I'm trying to connect my Xperia P to arduino via Bluetooth (HC-05). But when I select my HC-05 device I get a "507 Unable to connect" error.
I have thought i made a mistake but i checked everything and i think my code is ok, and it is very simple (it is attached in this post).
If I'm using other apps on google store i can connect to my device, so it is working
Is there something i have to know with compatibility or else?
Now I'm using an Xperia P with Android 4.1.2.



--
see this screenshot about how to connect correctly

--

Thank you for your answer but this is not useful for my problem. I still have this issue.
I want to know if this is a bug of App Inventor  or if I'm usning it in a wrong way.

--
well, first of all you should connect correctly...
and if you still get error 507, just try again or do a test using another device
see also these threads: search results for bluetooth 507

--
I'm trying in every possible way. I'm using another app called ArduDroid and with it i can connect easily. So i don't think my cell is not able to connect, i think i have a problem with the app.
I'm following your instructions and i have read all those thread on your link but it still not works.

--
THE SAME HAPPENS TO ME. WHY ?????

--
I can't understand what you mean. Where is the problem, please?

--