This Notes is according to the udacity free course :
Android Development for Beginners
Lesson 2A : Make the Quantity Picker Work
In Last Class we still cannot fix the problem to increase the coffee quantity automatic.
After the practice, now we can face the problem.
In this class, the most important concept is Global variable.
Keep it in your mind, it is the key word to fix the problem.
We use one pic to explain what the problem we face on.
We can see that "int quantity = 2" is exist in different code sequence with a complete brackets, they execute the action individually.
And Now, what we have to do is to level up the code " int quantity = 2" to a public class.
Tips : When you create a global variable the words will turn into purple. If it is a local variable, it will shows up in black.
H.W.
The Code is create a GLOBAL VARIABLE and the "int quantity = 2" is under " public class MainActivity.
After the procedure, you can update the coffee quantity immediately.
Press Run and check out your application.
Android Development for Beginners
Lesson 2A : Make the Quantity Picker Work
In Last Class we still cannot fix the problem to increase the coffee quantity automatic.
After the practice, now we can face the problem.
In this class, the most important concept is Global variable.
Keep it in your mind, it is the key word to fix the problem.
We use one pic to explain what the problem we face on.
We can see that "int quantity = 2" is exist in different code sequence with a complete brackets, they execute the action individually.
And Now, what we have to do is to level up the code " int quantity = 2" to a public class.
Tips : When you create a global variable the words will turn into purple. If it is a local variable, it will shows up in black.
H.W.
The Code is create a GLOBAL VARIABLE and the "int quantity = 2" is under " public class MainActivity.
After the procedure, you can update the coffee quantity immediately.
Press Run and check out your application.
留言
張貼留言