In my application, if the user has guessed the right answer, then 10 points will be given, and then newCoin < / Code> and then using the
newCoin
value activity
will go to intent
.
In each question, 3 helps when the user clicks on help1, then the score can be reduced from 10. If the user clicks on help2
, then the score should be reduced from 10 (the same goes with help 3)
When I have any help (help1 / help2 / Help3) is cut from newCoin
10. But when I click on another aid, the current coin is not cut. What's the problem
This is my code
int scoreText; Int newScore, newCoin = 0; Protected void onCreate (bundled saved instenstate) {super.onCreate (SavedInstanceState); SetContentView (R.layout.luzon2); Intent = getIntent (); Int myValue = intent.getIntExtra ("parameter name 2", 0); Last full newCoin = myValue; ScoreTxt = (TextView) findViewById (R.id.score); ScoreTxt.setText ("+ newCoin"); Luz2he1 = (button) findViewById (R.id.btnLuz1); Luz2he1.setOnClickListener (New OnClickListener) {@Override Public void onClick (see v) {if (newCoin> = 10) {newScore = (newCoin-10); ScoreText .set text ("+ + + newScore);}}}}); luz2he2 = (button) findViewById (R.id.btnLuz2); Luz2he2.setOnClickListener {NewOnClickListener} {@Override Click Public Zero (see V ) {If (newCoin> = 10) {newScore = (newCoin-10); ScoreText.Set Text ("+ + + newScore);}}}}); Luz2he3 = (button) findViewById (R.id.btnLuz3); Click on Luz2he3.setOnClickListener (New OnClickListener) {@Override Public Zero (see V) {if (newCoin> = 10) {newScore = (newCoin-10); ScoreText .set text ("+ + + newScore);}}}}}}
< P> Update the 'newCoin' value in all support methods.
Click Public Zero (see V) {if (newCoin> = 10) {newCoin - = 10; NewScore = newCoin;
जावा प्रोग्रामिंग कोडर्स के लिए नमूने
ReplyDeleteग्राफिक्स जावा कोड में पेंटिंग