2014년 12월 7일 일요일

Setting a List as a Variable


ok. I'm trying to build a quiz. When I run it in the emulator, all is fine, yet when I make it an app and install it on my mobile, the error shows up: "Runtime Error: End Application" "Select List Item: List Index too large". Now I know what causes this.but I don't know how I can program this otherwise.

Here is what I thought: I have five lists of four items each. WHen the user clicks Next button, the variable ActiveList is set to List1. I defined the activeList variable as shown in the attachment. I believe they cause the error as the list isn't there yet and the index doesn't exist. How can I overcome this?


--
Hi, it is not a good idea to leave the block connectors empty. For the first you should say create empty list, and for the second just an empty text string would be ok.
Later, you will reassign the variables with what you need.

--
Ghica, thank you for the guidance, yet I did what can but still I get a runtime error. interestingly, before I made the changes you said, the apk would ask for permissions to for wifi and phone(sth I don't remember exactly) but now it doesn't. But again, runtime error. I'm uploading the whole aia here, if anyone can check and tell me what I misconfigure... Thanks in advance. 


--
How to work with Lists by Saj

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...


To download the aia file, upload it to  App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...

--
Hmm.. you're right. I couldn't figure that, as I'm having headaches trying to solve this thing and as I'm still a rookie... A general question I would like to ask first, is it normal for an app to work fine in the emulator but give runtime errors as an apk? In my situation, everything works fine. I believe the trouble is caused by the blocks in the attachment. I'd be grateful if we can sort this out. 

And yet another question: Is there a standalone version of AppInventor2? my connection is terrible sometimes, so I'm having difficulty even connecting some blocks... Thanks for your help in advance.



--
What I see in your blocks is that you have indexes for a list that are 0. But the first element in a list is 1. You must initialize them to 1.
Yes, there are a few standalone versions. Just google for them.

--
Hossein's AI2LiveComplete has a standalone system...http://amerkashi.wordpress.com/

--
Thanks, all solved, though "set global UI to Terrible(!)", the procedures do as I wanted them to. Thanks everyone for the help..

--

댓글 없음:

댓글 쓰기