I'm a beginner at App Inventor and I don't know what I'm doing wrong with the listpicker.
I am trying to create and app to reproduce the music I have stored in my server but when i display the listpicker I can't click any of the options and also I can't go back to the first screen. Here I put my code:
Image 1
Image 2
I tried to remove the line that says call listpicker.open but it only made appear a totally black screen.
The result of the code I just posted is exactly what I spect a list with the name and the link of the 2 songs I already upload to my server but when I click them it didn't do anything.
Thanks for your help.
The Web component works asynchronously, which means, it takes a little bit, until the result is available. The result you will get in the Web.GotText event.
Therefore it does not make sense to call the updateListpicker procedure in the Listpicker.BeforePicking event, because the result still is not available and you get displayed an empty listpicker. The listpicker will be opened, before you have received the result!
Set the listpicker to visible=false and use a button.click event to call the updateListpicker procedure. Then as you already do it in the Web.GotText event, assign the received list to the listpicker and open it.
Related
enter image description here
I get the followingg Toast outputs
CODE IS RUNNING
and
s
So my code is running but my_shop is not being changed?
Your code is working fine, I think you are a bit confused as to how the code above actually works. the onDataChanged method is triggered/called asynchronously ONLY when the data in the database/server changes, hence the toast-'CODE IS RUNNING' is displayed correctly.
But you are checking the my_shop.getShop_name() outside the onDataChanged method, hence by the time the program counter reaches the second toast, the onDataChanged method hasn't been called yet. The shop_name is still the one that you assigned in line 2 which is what is displayed on the Toast! (which is why you think the code isn't running properly even if it is working fine!)
I would suggest you read more about event listeners in general to get a better idea abouut this behaviour! you can read more about the API in the firebase documentation: https://firebase.google.com/docs/database/android/read-and-write
App flow:
ComponentOne:
Take photos with phone
Send photos to api
Navigate to ComponentTwo
ComponentTwo:
Render component
NOW response from api is received in ComponentOne, after render of ComponentTwo. (Resulting in component not being able to display response since it was received after rendering of component) Desired result is that the loading spinner will spin until response is received from api and when received immediately display it in ComponentTwo.
I am passing state from one component to another, the state, called "loading" starts off as "true" and is supposed to change to "false" when response is received from api, however even though it changes in ComponentOne, ComponentTwo still displays the spinner...
This is how I navigate to second screen and pass the state with it.
this.props.navigation.navigate('ComponentTwo', {loading: this.state.loading});
This is how I receive the state and do the conditional rendering, the spinner is supposed to show until the response is received from the api, currently however it just keeps spinning even when data response is received.
{
this.props.navigation.state.params.loading ?
<Spinner/> :
<Text>Display response from api when it is received</Text>
}
Why does this not work? Why does state not change in second component and render the results, instead it keeps on loading forever. Can you not pass state from one component to another and expect it to change?
Edit: "loading" is set to "false" in ComponentOne right after response is received from api, navigation to ComponentTwo happens before this, therefore I want the spinner to show until data is received.
Edit2: Anyone know how I can do this using redux? I have redux in the project but don't know how I would do so that loading would be set to false when my variable(s) would get a value as response from the api.
I'm not quite sure, that navigate params work like react state/ props.
It is a one way street to pass params onto the next screen. These won't update.
You should instead have a component wrapping this two screen that pass props down. THIS will update if you update the state of the wrapper component.
Wrapper could have a state for photo, and once it's updated with the image url it will trigger a rerender and the props will trickle down to the attached components.
Hope this helps.
I put some user properties in my android code such as:
(https://firebase.google.com/docs/analytics/android/properties)
mFirebaseAnalytics.setUserProperty("easy_account_connected", "true");
Then, I checked debug view and nothing appears whereas if there is a break point, my code stopped on this instruction. I can't understand, in my code there are other places where we can find these properties and sometimes it works (I see it in debug view) and sometimes, nothing.
Is it normal ?
I have found nothing on firebase website which could tell me debug view is not perfect but data are correctly saved ...
https://firebase.google.com/docs/analytics/debugview#seconds_stream
EDIT :
With the help of adbitx, I discovered user properties are sent with event so I made a new use case.
2 events (login / logout) and one user properties (easy_account_connected). In login case, I send :
mFirebaseAnalytics.setUserProperty("easy_account_connected", "true");
mFirebaseAnalytics.logEvent("login", null);
and in logout case, I send :
mFirebaseAnalytics.setUserProperty("easy_account_connected", "false");
mFirebaseAnalytics.logEvent("logout", null);
Here is the result in debug view
Login works whereas logout does not...
From what you describe, it looks like you only have that line and no other events. It would be nice to know whether you send any events after setting the user property. The user property comes with each event after it is set. Therefore, you need to send some events and click on one of the events in the debug view to see the user property under User Properties tab.
I was running into a similar issue.
I found that sending the app to the background was a way to "flush" the cache of user properties on the device and send them through to Firebase. I could then see them appear in DebugView.
Without sending the app to the background I would see event after event appear in DebugView, but no user property updates.
Expanding the functionality of an under development app, I need to show to the user a progress notification dialog. Problem is, I cannot get it done right. Furthermore, I cannot dismiss this notifier properly. Have tried with a clock and a variable set to e.g. "5000ms" and then to "0", without any lack.
What I need to achieve is the following functionality:
a. Check if the tag "storeparsedData" is in a TinyDB, populated with the fetched JSON data. I have this done, following #Taifun advice in my relative question.
b. If the tag is not there (empty list), do a getWeb.gotText block to get the JSON data (this is done with procedure "getWebData". This functions right, but takes a while about 1'35'' or more, so need to show something to the user.
c. While fetching JSON data form web, need to show a "ShowProgressDialog" notifier to the user, so I can cope with the smartphone being seemingly freeze.
d. If the tag "storeparseData" is populated with fetched JSON data, dismiss the notifier.
Have tried the following coding, without relevant success:
Can someone help me out, to achieve this functionality in this app? A blocks code or something to follow and learn, will be awesome.
Thank you all in advance for your answers.
[Edit1]
After #Taifun suggestions, the functionality in question seems to be working, but there is a problem."ShowProgressDialog" block never fires, neither on device or companion. Also where should block "DismissProgressDialog" be attached to disable notifier upon JSON data received?
Here is the reviewed blocks code, for checking stored tags in TinyDB. "ShowProgressDialog" never fires as it should. Are there any suggestion for this issue?
Here is the blocks code for the getWeb function to get the JSON data:
Please advise, with a block code if applicable.Thank you all.
Your progressNotifier.AfterChoosing event never will fire, because that event only fires after choosing something from a Notifier.ShowChooseDialog block, but not for Notifier.ShowMessageDialog blocks. Therefore use a Notifier.ShowChooseDialog block instead and set the second button in that block to empty string.
Your while loop will freeeze your app, as you already realized... You do not need the Clock.Timer event at all to check if your data is there.
Just do it like this: after having received your data in the Web.GotText event and having stored the data in TinyDB, then dismiss the progress dialog and display the message "Database is ready".
Update: Instead of storing your list n times inside the for each in list loop, you should store it only once after the for each in list loop is finished... Same for the DismissProgressDialog and ShowAlert block...
What is the purpose of that join block? You might want to remove it...
I'm discovering Calabash, using it with cucumber and I'm having an issue.
I started some code to test my basic app :
Scenario: I can see a button Test Button
When I enter "Something" into input field number 1
Then I wait
Then I press the "Test Button" button
Then I wait
Then I should see text containing "Something"
Then I go back
Then I rotate landscape
Then I wait for 5 seconds
Everything works fine and everything is passed until I arrive on the device rotation step. It just doesn't work (doesn't rotate) and is treated as an "undefined" instead of passed and the very last line gets "skipped"
The test ends like this.
I checked everywhere and just can't figure out why it doesn't work.
Could anyone help me please ?
As mentioned in comment - disable rotation lock.