Note that there are some explanatory texts on larger screens.

plurals
  1. PORetain Values from edit boxes android code
    primarykey
    data
    text
    <p>I have this code, I want to retain my value of the editbox from the first input after change or start of new activity.</p> <p>this what happens in this code: </p> <pre><code>editbox1 = 1 &gt; start new activity &gt; back to recent activity &gt; editbox1 = null </code></pre> <p>I need this to happened: </p> <pre><code>editbox1 = 1 &gt; start new activity &gt; back to recent activity &gt; editbox1 = 1 </code></pre> <p><strong>CODE</strong></p> <pre><code>package org.example.touch; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.*; import android.widget.EditText; public class SettingsClass extends Activity { private EditText Alpha; private EditText Beta; private EditText Charlie; private EditText Delta; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings); Alpha = (EditText) findViewById(R.id.editText1); Beta = (EditText) findViewById(R.id.editText2); Charlie = (EditText) findViewById(R.id.editText3); Delta = (EditText) findViewById(R.id.editText4); } public void buttonSBHandler (View view){ String Aint = Alpha.getText().toString(); String Bint = Beta.getText().toString(); String Cint = Charlie.getText().toString(); String Dint = Delta.getText().toString(); Intent startNewActivityOpen = new Intent(SettingsClass.this, GameUi.class); startNewActivityOpen.putExtra("Aint", Aint); startNewActivityOpen.putExtra("Bint", Bint); startNewActivityOpen.putExtra("Cint", Cint); startNewActivityOpen.putExtra("Dint", Dint); startActivityForResult(startNewActivityOpen, 0); //startActivity(new Intent(view.getContext(), GameUi.class)); } } </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