2014년 12월 29일 월요일

How to change app name

how can i change th name of my apps.i really want to change it



Maybe this helps?

Now you can type in a new name and you will have a copy of your project with this new name.
Or was that not your question?



in case you are talking about the package name, see here


title bar removal

Hi, I've noticed that the title bar in a finished app is rather unsightly and unnecessary, I read on the forums that it can be removed with apptomarket, I used the software and removed the title bar which was fantastic. Now I have an issue. I tried to upload the .apk to Google play but get the message that the keystore is different to the previous keystore used to upload app. I realize that I can export the keystore for app inventor but I have no idea how to use it with apptomarket. Any help would be great. Also it would be great if there was an option within app inventor to remove the title bar as it does make apps look very old.



please ask in the AppToMarket forum https://groups.google.com/forum/#!forum/apptomarket
and if you do a search for keystore there, you also might find an answer...

btw. I think, to remove the title bar in MIT App Inventor directly will be available in soon...


Display quality is very low ( looks blurred).

The picture quality is very poor.
I tried using native resolution of my moto-g handset.
But the pictures seems to be blurred.



Are your images larger than the screen size.  When large images are reduced in size, the frequently will appear blurred; also, when small images are made to fit a specific component that is larger than the image, the images will be blurred.  Experiment with   Automatic, Fill Parent   and setting the Height/Width of your images using code.  Perhaps you will find a combination where the images are clear.

Perhaps this is not what you need to know?       A screen capture image would help users in the forum to understand what you are talking about.





Reset variables in an same screen

I need find out if there any way  of do any reset of all screen..  something like as when exits and reenter the App that reset everything the variables  but obviously without doing this because not  it would be logical. In briefly I need  clarear all the variables without leaving of all the screen. I tryed delete placing an text empty to each varible, but apparently does not work because when I tryed save any data with TinyDB I not overwrite the new datas to save. Any idea.?

Annex a picture of the that I did.




to reset everything in TinyDB, just use the TinyDB.ClearAll block

ClearAll()
Clear the entire data store


Phone Signal Strength

How do I get Phone Signal Strength using App Inventor?

I'm trying to work on a project that needs Phone Signal Strength to be captured.

Appreciate any help.


How to read a file

I want to read a saved record as a file, but somehow it just wont work. The saved directory is "/storage/emulated/0/ My Documents/Recordings/NAME.3gp" but these all don't work:
  • Reading exact this directory
  • Reading this directory without the slash at the beginning
  • Reading this directory with a "file://" in front
  • Reading this directory with a "file://" in front and without the "/storage"
Does anyone know what I am doing wrong or cant you open files on the device memory?



you like to read the sound file with the Player component, correct?
does this snippet work for you? How to use the Sound Recorder

the correct path to your file is this:
file:///mnt/sdcard/My Documents/Recordings/NAME.3gp

note: file names are case sensitive!



Is that a blank I see before the word " My" ?



@Taifun, no I want to read it with the file component to change the name of the file by saving it again with a different name and deleting the old one.
@Abraham Getzler yes it is or is it actually a "_" (underscore), because both the File-Browser on my phone and a notification in App Inventor show it as space



as you can see from the documentation, http://ai2.appinventor.mit.edu/reference/components/storage.html#File
this should work

/My Documents/Recordings/NAME.3gp

of course underscores etc. must be considered
if you store the recorded sound file in a global variable, you only have to remove the leading /storage/emulated/0 to get the correct path for the file component

however I don't know, if you can read the sound file as text and store it again using another name, you can test this, just let us know what you find out ...



Reading a sound file as text would probably give just everything
up till its first hex zero byte.  Isn't that the universal text stopper?



Actually it seems like it got some of the "text" from the sound file but then the media player cannot read it, probably because there is some of the "text" missing from the sound file.
Do you know another way to rename or/and move a file?



you could send your file to a web server, see this examplehttps://puravidaapps.com/postfile.php and download it again using the web component and the GotFile event. The filename you can define in the ResponseFileName property, see also http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Web



Well that is too complicated for what I want to use it for but still thank you to both of you :)


App Crashes With Start Value

So I'm creating a game. So in my app every time someone clicks a button their score increases by +10, but when they get three wrong they go to another screen (Fail Screen) which takes the start value of their current score and their best score when the "fail screen" opens, and displays it (Capture 3 - Image Name). Then the person click the play again button and then opens the instructions page with the best score as the start value (Capture 1 - Image Name). Then on Instructions screen the best score start value is displayed in a hidden label, and then when continue is pressed on the "Instructions" screen the best score {displayed in a hidden label} (Capture 2 - Image Name)  is taken to the level 1 screen and displayed it on the level 1 screen (Capture - Image Name) 

The problem is after the person has played one round and fails they are taken to the "fail" screen and then they click the "play again" button and go to the "Instructions" screen but on the "Instructions" screen when they press the continue button to go the level 1 screen the game crashes. Says the game has stopped. 


Sorry i know it is long and confusing but i really need help on this if you need more info or pictures let me know. 







it seems to be, you are never using the close screen blocks
see here how to switch screens correctly

The recommended method of switching screens in App Inventor




is there a way to carry a "start value" when the screen is closed? Like when we say open screen name ____ with start value ________ ??? 




If you say open with start value, the value is passed to the opened screen.  If you have to get the value back at the original screen, you can use the close screen with result block and trap that back on the original screen.

You can also, almost more easily, transfer this sort of data from screen to screen using a TinyDB...



Share function

About the share function, can add share too Facebook, Facebook Messenger , Whatsapp or anything else?



or how to share something to Facebook?



http://ai2.appinventor.mit.edu/reference/components/social.html#Sharing



How to share text with Facebook using the Activity Starter by Suyatmo and Peep


Incorrect behavior of TextAlignment property in Canvas component

Hi.
    Just now, I wanted to create my own working button in canvas component. It's hard to center text in shape in case, when a start of text area isn't centered, so i found property of canvas component -TextAlignment (only in designer).
    Problem comes when I choose option Center. It has same behavior like option Left. I tried all options (Left, Center, Right) through emulator and on my phone by usb also. It seems, only option Center is wrong.
    Is it a bug? Does anyone have same problem? or problem is on my side only?
    I attach screenshots from phone capturing every textalignment option.
Тhanks for any help.






Thanks for reporting this.   I've fixed this, and also created blocks for Canvas.TextAlignment.   You should see these in a system update not too long from now.


Reducing Numbers Logic ?

Having a post Christmas brain malfunction!

To my mind this should work, but i am still getting duplicate numbers out of it. What i am seeking to achieve is a different number between 1 and 100 on each click of the button, the code should prevent previously selected numbers from appearing in the label text again. But they do. What have I missed ? ( It must be something simple!)  (Variables set to 0 so that the first run, using 0 gets excluded)




"if false" always is false, which means always the else part will be executed and never the then part...



Of course :D

I'll try with the "if thing in list" test from the while loop?



Turned the logic around and tidied up things to prevent running out of numbers. Still get the occasional repeated number in the text box though....




It's simpler to keep a shrinking list of numbers that HAVEN'T been selected yet.
Start with all the numbers from 1 to 100,
pick a random index in that list,
copy the number at that index, then drop that index from the list.
The list will shrink, but you will never have to re-try selecting
from the list because of duplication.



Yes ABG, have done it that way before and it works well, seeking to avoid having to create long lists by hand. Possible to programmatically create a list 1-100 ? For Example ?




There's a FOR RANGE block you could use instead.
It would save a block and it would be repeatable

(self-initializing).



See attached, showing how to fill the list.




Nice :)


withdraw smaller number from a list of numbers

I created a list of 5 numbers as shown in the attached image and do I remove someone with the code provided in the image attachedsuccessive

how can I get the element of fewer elements left in the list?

example:
I initially list: 1,2,3,4,5
after the for loop I list 2,4,5

how can I withdraw and then remove from the list 2
then pick up and then remove from the list 4
and finally the 5?






If your list looks like 2,1,5,4
what should it look like after your procedure?



You will need to make an extra variable to
remember the position of the smallest number
in your list.  

Call it Index_of_Smallest, and start it off at 1.
For each n from 2 to length(your list)
  If listValue at position n < listValue at position Index_of_Smallest
     then set Index_of_Smallest = n
end For loop

Delete the list item at Index_of_Smallest



Also, looking to your blocks,
if you want to keep 5 text boxes T1-T5,
you should put their component blocks into a list
at initialization time, and use the Any Textbox
blocks to manipulate them by index in that list.

That will simplify your code and reduce your block count.


I cannot save my project to .apk.

I have a problem with make .apk file.

This is my code error. I want to know where it is error. I have 3 screens and 2 pictures.

Thank you for help.






You possibly are accidentally assigning a text value where the code requires a number?     The error might be related to how you call a ListPicker.  We can not check your coding if you do not provide a screen capture image of your blocks (jpg or png).

So, guessing, one of the following  possibly applies to your code (all may not apply to your code).  Most likely 1  or  1 and 2.:

1)  You have coding errors in your blocks.  In the Blocks editor, look in the lower 
left corner of the window for the yellow and red triangle icons. If the red icon has a value larger than 0, 
you have a serious coding error.  Find the block in your code that has a red triangle and 
fix it.   Red triangles always inhibit creating an apk or running a project in the 
emulator or possibly creating an aia file.     Yellow triangles are more forgiving, 
however, sometimes, these need to be fixed because they trip an internal warning and not billing puzzle piece sockets are left un-filled.

2) Your source file (the aia file) is larger than the 5Mb limit allowed in AI2 (the aia can not be larger than 5Mb). You may have put images or other resources in your Media (resources) that you do not use in the app. 
 All the images and sounds in resources count toward the 5Mb limit along with the source code.    You can program 
apps larger than 5Mb in the browser, but the apps will not compile and might not run in the 
emulator or the project may not save as an aia. If this is the case you need to reduce 
the size of your image and/or sound files.   Most image files can be made quite small 
by resizing them using a photo manipulation program on your PC to less than 50Kb each.

3)  You might have more than 10 Screens in your app.  AI2 becomes unstable when more 
than ten screens are used.  Projects CAN be built with slightly more screen but then you should expect your app to occasionally behave erratically.

4) You might have set a Screen icon in the Designer Properties for your project that is too large. Use an image 
sizeof 48x48 px or 96x96px instead and only use jpg or png images.  *.ico files are not 
supported.  The 'icon' (actually an image) can be as large as 520x520 (I think that is the size GooglePlay apps require).  The smaller 'icons' work fine otherwise.

5) You did not code the entire project using App Inventor 2.   If you used one of the 
third-party AI2 clones,you might not be able to load a Project into the AI2 compiler or 
create an apk with the standard AI2.

6) If you incorrectly modified the project's Manifest files using a third-party tool, you may have issues.

7)  Sometimes, if you have LOTS of Layouts on a single screen,  the apk might not 
compile. How many is a lot?  I do not know, keep adding layouts and buttons, compile and try again...when the server crashes, you got a lot.

8)  The network you are using may be overloaded (possibly a school network), or you have other applications running in the background on your computer, or your virus checker is doing a scan.  Sometimes, just trying to access the MIT server a few minutes later will give you a more favorable response.

9)  If you have BlueStacks on your home PC (BlueStacks is a special emulator that allows Android apps to run on a PC).  The Google emulator on AI2 cannot run unless BlueStacks is disabled and all of the BlueStacks processes are shut down.  On a Windows PC, you use the Task Manager to 'kill' running processes.

10)  Are you using Sensor controls (except for the clock)?   Most Sensor controls or controls related to sms or the phone do not work in the emulators.  They need to be tested on a device.

11) If this is an issue about the Project loading slowly on your device or on the emulator:  Be aware, the more images, layouts, components you have on a screen, the longer it takes for the emulator and Companion to render the graphical screen.  How fast the emulator renders is partially a function of your hardware...how much ram you have, your cpu clock speed etc. Sometimes, with lots of graphics, the emulator will just give up.   Can you develop live using WIFI or using USB? These options almost always render faster than the emulator but will not be at lightning speed if you have lots of graphics.  Be patient.

12)  This happens too:   We have seen instances where it is probable the Google Cloud messed up; other instances where an older PC has had memory issues and caused file corruption of the Project and instances where a user is using a very slow Internet connection (like dial-up) and it is just too slow.

13)  Do you have an AVG, Eset or AVAST virus checker.  Some versions of these products have been reported inhibit running the emulator unless (in the case of AVG) the Advanced Link settings on the software are set to allow AI2 communication.



This is my code.

In this code I use TinyDB like a list. I don't know that it is wrong point or not but I want you to help me solve this code. Thank you so much!






for lists stored in TinyDB, the valueIfTagNotThere socket should becreate empty list instead of a text

same for the other screenshot



Where are your close screen blocks?     If you open a screen, you use system memory.   If you do not close the screen (except Screen1) when you leave the screen, the system memory the screen uses is not released. Open a screen several times and your app  may/will run out of system memory and the project will freeze.



Thank you so much! SteveJG and Taifun.

After I do after your advice my code looks great but my problem about make .APK file isn't that point.

It is about comma.

This is the code before I can make APK file. you can find it in my last comment. And after I delete comma it cans make APK file. I'm so sorry about my stupid mistake and thank you very much. Goodbye and happy christmas.




Need Web Object to be a certain pixel width or percentage of screen but websites

Need Web Object to be a certain pixel width or percentage of screen but websites keep reading my device screen width and render webpages so that they are too wide for my specified browser width.... can anyone help? My program must have a certain width or percentage of screen, it is based on that ... I am hoping there might be some code I can insert somewhere in a tag or something to get round this problem ... I have specified width in tables, and every trick I can find but to no avail .... any help would be appreciated ...




Are you using a device with a screen smaller than 3-inches?  It is difficult for developers to presently develop for those mini-Android screen devices that have screens smaller than 320 x 480 pixels.

App Inventor 2 can not presently auto-scale to different screen dimensions using percentage  AI2 uses Android API 3.  It will migrate to API 4 sometime in the first quarter of 2015 (at least that is the hope) to API 4  and will have percentage capability at that time.  You can attempt to use the property   Fill Parent .

I am not sure that will help with your issue regarding Web pages.  You might try using the ActivityStarter to view Web pages rather than the built-in AI2 Webviewer (which is NOT a full web browser).   Using the ActivityStarter will allow you use of your device's default web browser.

At the moment, here is your best friend:

Universal screen size by Sajal



the webviewer of App Inventor and also any mobile browser only can display a webpage as it is designed, this also is called responsive webdesign.
https://en.wikipedia.org/wiki/Responsive_web_design
If the webpage is not designed for mobile devices, you will have to scroll.



I already tried the Activity Starter way but it opens a default web browser 'outside' the dimensions of my program, at entire screen width, and that is not what I want... I am resorting to attempt Eclipse and learning some java to try and complete the program... I am so close but cannot get the webpages other than cnn.com to auto wrap the text on their pages to fit in my table columns even using Fill Parent does not work ....



how come cnn.com autowraps the text but other sites do not? When you change a column width or percentage of screen assigned to web object the text (which is all I care about) auto wraps and fits within my table column...So, then why?



And, I am using a Note 3 phone, a Note 10 tablet, a Note 1 phone, an Asus Transformer tablet and a google Nexus 7 tablet and the issue exists in all ....



read again my previous answer...
If the webpage is not designed for mobile devices, you will have to scroll.



even mobile websites will not auto wrap the text ... I have checked that already only cnn.com seems to be able to do it ....



I am making a comparison program.... two web objects side by side .... works great on device loaded text files and cnn.com ... but all other sites, including mobile sites, do not work because they will not auto wrap the text to the decreased width, they keep sending the rendered pages out as my device widths .....



I am not concerned with images .... they can stretch out of view in the columns ... thats not the purpose of my program ... it is for text only ....



Sorry Steve, and thank you for replying, but I have already accessed that tutorial and if you check below in my discussion with Taifun you can learn more about what I am up against ...



webpages often use the screen size of the current device to display the webpage in a responsive way https://en.wikipedia.org/wiki/Responsive_web_design
the webviewer in App Inventor and also any other browser does not have any influence on that



Is there a way to get it to wrap_content as I have just discovered and am reading about in eclipse? If I could insert that java code somewhere in a tag, etc in ai2 that would suffice... And why does my table column width specification determine the text wrapping that works when I webviewer browse to CNN.com? I guess their site doesn't auto respond to device width the way others do... In this case I am therefore stumped and my program will never work in ai2...I am not prepared to give up that easily ...



I NEED TO BE ABLE TO WRAP CONTENT IN WEBVIEWER....CAN ANYBODY HELP? pLEASE???




Thank you for using App Inventor to create an interesting project!

Unfortunately, it seems that due to the constraints of the API that App Inventor currently uses, we may not be able to fulfill your request. Please be patient, and recognize that App Inventor currently does not have all of the capabilities that exist in programming for Android through Eclipse (Java).

Your best option is to read the documentation for the WebViewer component: http://ai2.appinventor.mit.edu/reference/components/userinterface.html#WebViewer. You can try setting a value to the Width component, but as stated in previous replies, you may not be able to control how the web page shows up on the screen of the phone; this is due to how that page is programmed, and you may not be able to control it in your app.

Another option is to read the documentation for the Web component: http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Web. You could redesign your app to show text in your columns, rather than showing the web page. However, this may require you to work more with individual web page APIs, and thus limit the flexibility of your app.

Finally, you can try to program your app in Eclipse using Java. This will give you the most control, but will also be fairly difficult if you are unfamiliar with programming for Android.


Good luck and happy apping!



Thanks for your reply Aubrey. I am trying Eclipse, just don't have much time at present but am looking forward to getting the time. I just want to say that, you may only now realize that having an option to set the width of the web viewer in ai to match parent, automatic or set pixel width is not of much use when the webpage is incapable of wrapping at least the text.... possibly in upcoming versions you may consider this very powerful feature and include it in upcoming changes to ai. Thank you for your reply though...I am still hoping and digging ....


How can i define the exact position of a component?

I was wondering if i could define the exact position of a component (i.e. not use the default positioning layout.) If you can tell me the answer to this i would be incredibly grateful. Thank you.



At the present time, you cannot.



In the old days when I was young, we used x and y values to place buttons and fields, but today, with users having many screen sizes, it is much better to use a layout mechanism which helps you adapt to these screen sizes. AI2 is at the moment not very good at that, but it will become better when it supports newer versions of Android, we hope soon now. You can be rather inventive with table layout, left or right adjustments etc.
It will never become as good as CSS3 or Java etc. but that should not surprise you.

On a canvas you can position sprites anyway you want. For a game this may just be what you need.


Help with Memory / Matching Game


Several of my students want to make memory or matching games where the player sees a number of face-down "cards," flips over two of them, and attempts to find a match. 

I'm pretty new to App Inventor and AI2 myself, so I made a prototype in AI2 and would appreciate your feedback about how I can revise my prototype to become as clear and simple as possible so that I can use it to guide my students. They are in Grade 7.

A screenshot of my code is attached. I used buttons as cards. A question mark in the button text represents the card being face down, and other text represents the card being face up.

Specifically, the most obvious area for improvement I see is that my prototype's code requires me to program each button separately. This creates room for bugs and goes against the principle of DRY ("don't repeat yourself"). 

This discussion and this discussion make it look like there's no built-in way to clone something or to use classes and inheritance to set the properties of buttons as desired, but this discussion gives me hope that I might be able to use coding language along the lines of "for all buttons on the screen, set the flipped-over text of the first two buttons to 'cat' (or something from a list) and the flipped-over text of the next two buttons to 'dog,' etc., to create matching button pairs that the player could find.

Is there indeed a way to make the code simpler for each button? In the final version, I would of course remove the commentary in places where it points out redundancy.

Are there also other ways to make the code simpler so that it would be easier for a Grade 7 student to understand? 


--
A while ago I made a tic-tac-toe game implementation in AI2 and a bit longer ago a memory implementation in JavaScript. 
Unfortunately there is no generic event handling possible in AI2, the best you can do is to make a procedure, which is called from the button.Clicked event which has as input an index number, pointing to the right button in a list which you made at initialization.
Here is a link to a pdf which shows the blocks http://www.squaringthecircles.com/AI2/tictactoe.pdf for my tic-tac-toe game. It is in Dutch, but it has not much text. It uses ImageSprites instead of buttons, but the principle is the same.
I can also send you the .aia if you wish. If you attach yours I will help you out.

--
Yes, there are ways to make your programming simpler.
In your lists, you can create the lists from a csv file.   If you are matching images, the list items should be names of images stored in your Media perhaps (cat.png, cat2.png, dog.png,  dog.png), if text, then the words should suffice.      list from csv row  text    where the text is cat.png, cat2.png, dog.png, dog2.png   or something similar.

Yes, you can use the Any component blocks (on the Block screen).   If you name your buttons  1 , 2, 3  etc. you might simplify use of these components.

Instead of using buttons, you might use a Canvas with sprites for the  matching elements.  Here is 36 buttons but on a Canvas About the amount of BUTTONs  they are not really buttons...the code will give you an idea how to do this. Use this in conjunction with image sprites representing your guessing tiles.

You will need to shuffle your lists  and unless you want the same 'game' to repeat itself, will need to  establish a random procedure that will select ALL items and distribute them randomly but will have to make sure that it only picks a random image once.  This can be done in code   OR   by structuring how you design your lists.  For instance, if you only have ONE cat image, your code is going to be complicated, but simplified if you have cat1 and cat2   which might be a copy of the identical image with a different name, chosen so that they do not need to be converted in other steps.  To that end, naming images 1,2,3,4, etc might make sense.

Here are two links where others made 'matching' games ...they may give you additional ideas.  These are AI Classic projects so be aware, look at the logic, not the blocks:



Some of these ideas may help you.  What you need to do is to experiment first using a simple project where you learn to work with the Advanced blocks.  As separate projects, consider programming the pieces of your game.  When you are satisfied with your algorithms, put them together.

Be aware, what you are attempting to program is NOT simple; it is going to require a lot of logic to get to work smoothly.

What have you tried w.r.t. the advanced blocks?

--
this example might help
see especially procedure "selected" 

quiz.aia

--