Note that there are some explanatory texts on larger screens.

plurals
  1. POJava code: change value of variable
    primarykey
    data
    text
    <p>so i have a very basic question. What my code does basically is this</p> <p>User checks a RADIO BUTTON to choose a time (they have 1 hour, 2 and 3), and then click on a button from Activity1, they are then taken to Activity2 where it has a TextView that shows the time ticking down in seconds</p> <p>I hope that part was clear</p> <p>Now, the TextView in Activity2 should show the time passing from Activity1 by passing time in this line from Activity1</p> <blockquote> <p>intent.putExtra ( "Time", time);</p> </blockquote> <p>Whenever I try this code, the result I get is always 0 as if it isn't changing the value of <em>time</em> according to my <em>if statement</em> I have included inside each isChecked radioButton block. So, help? I know there must be a very basic and easy solution. </p> <p>Thank you.</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.release_bicycle); one = (RadioButton)findViewById(R.id.oneHour); two = (RadioButton)findViewById(R.id.twoHours); three = (RadioButton)findViewById(R.id.threeHours); Go = (Button)findViewById(R.id.releaseBTN); Go.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //start bluetooth if (one.isChecked()) { new CountDownTimer(3600000, 1000) { public void onTick(long millisUntilFinished) { time = (millisUntilFinished/1000); } public void onFinish() { ... database } }.start(); } if (two.isChecked()) { ... } if (three.isChecked()) { ... } Intent intent = new Intent(current.this, destination.class); intent.putExtra ( "Time", time); startActivity(intent); } }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload